The error occurs in the following sentence:
Struct TM * ltime;
Char timestr [16];
Ltime = localtime (& header-> TS. TV _sec );
Error message:
Error c2664: "localtime": the parameter 1 cannot be converted from "const long * _ w64" to "const time_t *"
Analysis:
In vc6.0, time_t is defined:
Typedef long time_t;
It is actually long, so it can be used universally.
But in vs2005, it is different:
How to define _ use_32bit_time_t?
Typedef _ time64_t time_t;
Typedef _ int64 _ time64_t;
That is to say, time_t is a 64-bit integer.
Add _ use_32bit_time_t to the "pre-processing definition" in 'C/C ++ 'of the Project attribute to directly use long time.
Of course, we 'd better take yourCodeChanged:
Struct TM * date_tm;
Time_t time;
Time (& time );
Date_tm = localtime (& time );
In this way, you can use it.
[Thank you for your reference]
Http://blog.sina.com.cn/s/blog_4a5cd6280100h36z.html