Hi Alex, Thank you!
I tried this as like below. But, the date of the generated file is also 2008/01/01 12:00.
Should I do set the time differently?
My code:
#include "mbed.h"
LocalFileSystem local("local");
int main() {
// setup time structure for Fri, 9 Jun 2010 13:45:30
struct tm t;
t.tm_sec = 30; //37 0-59
t.tm_min = 45; //42 0-59
t.tm_hour = 13; //11 0-23
t.tm_mday = 9; //28 1-31
t.tm_mon = 6; //9 0-11
t.tm_year = 110; //109 year since 1900
time_t seconds_d = mktime(&t);
set_time(seconds_d);
FILE *fp = fopen("/local/pgx_04L.txt", "w");
fprintf(fp, "Date %s", ctime(&seconds_d));
fclose(fp);
}
Result:
content of the above file:
Hello,
I use LocalFileSystem to make a text file on the mbed(F: drive with Windows 2000).
I tried successfully the "Hello World!" sample program taken from the section of LocalFileSystem in Handbook. And, I always found the date of a newly generated text file is "2008/01/01 12:00". How can I have the current date/time of a generated file by fopen/fclose ?
Thank you for you help, in advance!