- 论坛徽章:
- 0
|
#include <stdio.h>;\r\n#include <time.h>;\r\n\r\nint main()\r\n{\r\n struct tm tn;\r\n time_t tt;\r\n \r\n time(&tt);\r\n tn = localtime(&tt);\r\n \r\n printf(\"%04d%02d%02d\\n\", tn->;tm_year+1900,tn->;tm_mon+1,tn->;tm_mday);\r\n return 0;\r\n}\r\n\r\n编译时报错:\r\n CC(大CC) test_tm.cpp\r\n\"test_tm.cpp\", line 10: Warning (Anachronism): Assigning std::tm* to std::tm.\r\n\"test_tm.cpp\", line 10: Error: Cannot cast from std::tm* to std::tm.\r\n\"test_tm.cpp\", line 12: Error: Pointer type needed instead of std::tm.\r\n\"test_tm.cpp\", line 12: Error: Pointer type needed instead of std::tm.\r\n\"test_tm.cpp\", line 12: Error: Pointer type needed instead of std::tm.\r\n4 Error(s) and 1 Warning(s) detected.\r\n\r\n请高手指点!!! |
|