问题 I have my C program with time function declared globally as follows: time_t t = time(NULL); struct tm *tm = localtime(&t); time(&rawtime); void file_name() { sprintf(buffer,"data/log_%d.%d_%d:%d:%d",tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); char *p = buffer; for(;*p;++p) { if(*p == ' ') *p = '_'; } printf("%s",buffer); } } void create_file() { file_name(); fptr = fopen(buffer,"w"); } void read_data(); { . . . . sprintf(buffer1,"_%d:%d:%d",tm->tm_hour,tm->tm_min,tm_sec);