I want to save typedef enum date to typedef struct data.
My code is
typedef enum weather {
clear = 1,
cloudy,
cold,
rainy,
stormy
}Weather;
typedef struct diary {
time_t date;
Weather weather;
char contents[MAX];
}Diary;
void save(FILE *pFile, Diary*da) {
fprintf(pFile, " %s %s \n",da->date,da->contents);
}
void in(Diary*da) {
int _weather;
puts("Enter the current date(YYYY-MM-DD) : ");
scanf("%s", &da->date);
getchar();
puts("Enter the current weather, (1) Clear (2) Cloudy (3) Cold (4) Rainy (5) Stormy : ");
scanf("%d", &_weather);
getchar();
puts("Enter the contents");
scanf("%79s", da->contents);
getchar();
}
I don't know how to change the number to words(clear, cloudy, cold..) and print out in output file.
And what exactly 'time_t' data type? I can't printout the date that I entered.