-2

Just a quick question, is it possible to create a new text file overtime i run my c++ program? I have an Airline Booking program and i want to keep the transaction of each user using notepad. If possible, how? Thank you!

Ja-mes
  • 1
  • How about storing the names of the files ( probably numbers , just to be easy, and add a new number each time the file is read ) in another file ? – Arun A S Mar 25 '15 at 06:43

1 Answers1

0

Use GUIDs to generate unique file names:

    GUID guidNew = __uuidof(0);
    HRESULT hr = ::CoCreateGuid(&guidNew);
    ASSERT(SUCCEEDED(hr));

    CComBSTR bstrGUID(guidNew);
    CString sGUID(bstrGUID);

    //remove braces
    sGUID.Mid(1, sGUID.GetLength() - 2);
Andrew Komiagin
  • 6,446
  • 1
  • 13
  • 23