Results 1 to 3 of 3
hi
i need to write a program that creates a file with name as current date and time as a file name
every time i execute a progarm it should ...
- 08-29-2008 #1Just Joined!
- Join Date
- Nov 2007
- Posts
- 27
need help in creating a file
hi
i need to write a program that creates a file with name as current date and time as a file name
every time i execute a progarm it should create a file with name current time and date
- 08-29-2008 #2
If your writing this program in C...just include the time.h header file and use the functionality included...
#include <stdio.h>
#include <time.h>
int main(int argc, char**argv)
{
struct tm *ptr;
time_t lt;
lt = time(NULL);
ptr = localtime(<);
printf(asctime(ptr));
return 0;
}
the rest you can figure out
- 08-30-2008 #3Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
And if you're scripting:
>/tmp/myfile$(/bin/date +%Y%m%d%H%M%S)


Reply With Quote