Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <string.h>
- #define SUBOR "date.txt"
- int main(){
- time_t t = time(NULL);
- struct tm tm = *localtime(&t);
- int actDate, fileDate;
- FILE *f;
- actDate = tm.tm_mday;
- f = fopen(SUBOR, "r");
- fscanf(f, "%d", &fileDate);
- fclose(f);
- if (fileDate==actDate)
- return 0;
- else{
- f = fopen(SUBOR, "w");
- fprintf(f, "%d", actDate);
- fclose(f);
- if (tm.tm_wday == 0 || tm.tm_wday == 6)
- return 1;
- else
- return 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement