First of all, my knowledge of X++ is minimal, I just need to edit the code I've been given. I have a C++ program which creates a text file and stores data in it. Right now the program is using:
outfile.open("C:/Users/Admin/Documents/MATLAB/datafile.txt", std::ios::app);
But I need to change this code so each time i run this code, it will create a new file name. My suggestion is to somehow incorporate the time/date as the file name, but I am unsure how to do this. I've tried researching around, and it looks like using time_t
is the way to go, but I'm unsure how to utilize it for my case.
Is it possible to save the time/date as a variable, then use:
outfile.open("C:/Users/td954/Documents/MATLAB/<DEFINED VARIABLE>", std::ios::app);
// ^^^^^^^^^^^^^^^^^^
if so, how would I go about this?
Thanks guys