I would like to use asctime to assign the time to a string.
time_t rawtime;
time ( &rawtime );
vector<string> TTime;
TTime.resize(10);
TTime = asctime(localtime ( &rawtime ));
I understand asctime is returning a pointer to a string. Would i have to create my own string and assign it the return value of asctime, or is there a simpler way?
You can construct a string directly from a
char *:This doesn’t make sense:
You can’t assign a single string to a vector of strings. What you can do is: