strftime - C Programing Filename is in chinese symbols -
i trying modify source code need create filename based on date filename being created chinese symbols. compiling using nmake visual studio , unicode.
i not sure whether code issue or compiler problem.
code extract:
struct tm * timeinfo; struct tm *__cdecl localtime(const time_t *t); tchar buffer[80]; time_t rawtime; rawtime = time(null); time(&rawtime); timeinfo = localtime(&rawtime); strftime(buffer, sizeof(buffer), "%d%m%y%h%m%s", timeinfo); prd->command[i] = '\0'; lptstr t; (t = buffer; *t; t++) { if ((*t != '<') && (*t != '>') && (*t != '\"') && (*t != '|') && (*t != '/') && (*t != '\\') && (*t != ':')) prd->command[i++] = *t; } //lstrcat(prd->command, buffer); = lstrlen(prd->command);
well after investigation prompted possible duplicate, have working code. had expected , investigated tchar conversion, not come answer. did more investigation on , came across wcsftime. seems have worked , means not need make other modifications code work , compiles fine in vs2013.
working code:
struct tm * timeinfo; struct tm *__cdecl localtime(const time_t *t); wchar_t buffer[80]; time_t rawtime; time(&rawtime); timeinfo = localtime(&rawtime); wcsftime(buffer, sizeof(buffer), l"%y%m%d_%h%m%s", timeinfo); prd->command[i] = '\0'; lstrcat(prd->command, buffer); = lstrlen(prd->command); s++;
Comments
Post a Comment