Link to home
Start Free TrialLog in
Avatar of jewee
jewee

asked on

Creating a filename using std string.

I am trying to create a filename with a timestamp using strings instead of chars.

ichar curDateTime[25];
time_t currentTime = time(0);
struct tm *temp_time;

temp_time = localtime(&currentTime);
strftime(curDateTime, 30, "%d%b%Y_%H", temp_time);

sprintf(filename, "%s/FILE_%s%02d%02d", filePath, curDateTime, temp_time->tm_min, temp_time->tm_sec);

What would be the easiest way to do this using strings?
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial