我看过这个example :
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
time_t current_time;
char* c_time_string;
/* Obtain current time as seconds elapsed since the Epoch. */
current_time = time(NULL);
但是在 eclipse 中调试时我在 watch
中看到地区:
time(NULL) error evaluating
虽然我有
#include <time.h>
我该如何解决这个问题?
最佳答案
您的调试器不够智能,无法评估时间 (NULL),除了不要在表达式窗口中键入“time(NULL)”外,没有任何解决办法。
关于c++ - 无法在c中获取当前时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18848591/