Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

C++ : filename using current date

Hi all..
i need to create new file with filename using current date..
Normally i just create new file with filename i hardcode in the program
e.g : fout.open("testfile.txt")..
But how can i give the filename using current date(system date)..
e.g : testfile0309.txt (03 - Month, 09-Day)..

TQ..
[322 byte] By [mrar_160] at [2007-11-11 8:14:09]
# 1 Re: C++ : filename using current date
there are a variety of date and time functions in <ctime>
jonnin at 2007-11-11 21:01:37 >
# 2 Re: C++ : filename using current date
can you give me any tutorial explain about ctime()..
I tried to find it, but still didnt found.
tq
mrar_160 at 2007-11-11 21:02:37 >
# 3 Re: C++ : filename using current date
Have you Google'd ctime? Give it a shot ... ctime is one of the library files included in the Standard C++ library.

Take a look, here: http://www.cplusplus.com/ref/ctime/ctime.html
nspils at 2007-11-11 21:03:36 >
# 4 Re: C++ : filename using current date
use asctime() or ctime() . Read mroe about them here: http://www.dev-archive.com/dev-archive/LegacyLink/9486
Danny at 2007-11-11 21:04:35 >