我試圖獲取一個時間戳來顯示系統提供的日期和時間。我收到'time','asctime'和'localtime'的錯誤 - 找不到標識符。我認爲這應該是一個簡單的解決方案,但我是一個新手程序員,我無法堅持。謝謝!找不到C++時間戳標識
#include <iostream>
using namespace std;
int main()
{
cout << "Content-type: text/html\n\n";
cout << "<center><h1>TEST</h1>\n";
return 0;
time_t tTime = time(NULL);
printf("Today is : %s\n", asctime(localtime(&tTime)));
}
在Google上搜索它們,你會發現你需要包含什麼頭文件才能很快包含。 – chris 2013-04-07 01:16:53
@chris你會這麼認爲,但我已經搜索,但仍然不知道。傷心,但是真的。 – Cliff 2013-04-07 01:18:28
如何在[本頁]頂部(http://en.cppreference.com/w/cpp/chrono/c/asctime)? – chris 2013-04-07 01:21:38