Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void pyExe(){
- /**arquivo .dat e arquivo .txt, respectivamente**/
- FILE *fp, *fp1;
- /**struct para leitura dos dados contendo os eventos**/
- struct evento *display = (struct evento *)malloc(sizeof(struct evento));
- char buffer[48];
- char email_events[] = {"dd_mm.txt"};//nome do arquivo.txt
- char msg[]={"Nao ha eventos disponiveis para hoje!n"};
- int count=0;
- time_t rawtime;
- time(&rawtime);
- struct tm timenow = *localtime(&rawtime);
- strftime(buffer, 48, "%d_%m", &timenow);
- fp = fopen(file_name, "rb");
- fp1 = fopen(email_events, "w");
- if(strcmp(buffer, email_events)!=0){
- strcpy(email_events, buffer);
- while(fread(display, sizeof(struct evento), 1, fp)==1){
- if (feof(fp) || fp==NULL){
- break;
- }
- else if(display->dia==timenow.tm_mday && display->mes==timenow.tm_mon+1){
- fwrite(display, sizeof(struct evento), 1, fp1);
- fprintf(fp1, "%s", "n");
- count++;
- }
- }
- }
- if(count==0){
- fprintf(fp1, "%s", msg);
- }
- fclose(fp);
- fclose(fp1);
- }
- strcpy(email_events, buffer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement