How to get time value as referenced parameter in C
I am not familiar with C too much, but for a project I have to do something with an开发者_运维百科 API...What I should do is to get the date info of some business entity which is encapsulated in API...
time_t _date;
...
..
FieldGetValue(....,&_date);//API's method which you have to give the variable
printf("Date: %s",_date);
I am not able to debug because of API's restrictions...I am just writing and deploying and see if it is works...But for this case in printf() line my app. just quits.
What I am asking for is how to get any date/time value from a method as referenced?
The printf
statement causes the app to crash, because _date
is a time_t
type, not a C string. Take a look at the time.h
header functions, where you will find a function to convert a time_t *
to a char *
that you can printf
.
精彩评论