Problem in struct date
1 2 3 4 5 6
|
int d1, m1, y1 ;
struct date dt;
getdate(&dt);
d1 = dt.da_day ;
m1 = dt.da_mon ;
y1 = dt.da_year ;
|
It doesn't work in code::blocks gcc compiler
It shows following error
|644|error: aggregate 'date dt' has incomplete type and cannot be defined|
|645|error: 'getdate' was not declared in this scope|
What I have to do or there is another method
Is
struct date
from a library you use or something? Do you include the right headers?
Closest you find in the standard library is probably found in the ctime header.
1 2 3 4 5
|
std::time_t time = std::time(0);
std::tm* dt = std::localtime(&time);
int d1 = dt->tm_mday;
int m1 = dt->tm_mon;
int y1 = dt->tm_year;
|
Thanks you solve the problem
Topic archived. No new replies allowed.