Ok, one more probably stupid question but how would I get the current time and use that to create a new file with the timestamp as the name of the file?
Ok, one more probably stupid question but how would I get the current time and use that to create a new file with the timestamp as the name of the file?
There is a time() function declared in a header file <time.h>. Check your compiler manual for further instructions concerning its value. And please ask all of your questions in one thread named like "My beginner questions".
The only good is knowledge and the only evil is ignorance.
~Socrates
I was looking for the same a few weeks ago, wth help from the forume i made it.
ctime (time.h) - C++ Reference
did something like this:
remember to include time.h
Code:time_t rawtime; struct tm * timeinfo; char buffer [80]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); strftime (buffer,80,"Sample-%b%d_kl_%H%M.txt",timeinfo); puts (buffer); FILE *fil1,*fil2; fil1=fopen(buffer,"w");