Changeset 104 for tools/ListenToArduino


Ignore:
Timestamp:
09/22/09 11:24:48 (15 years ago)
Author:
daqct3
Message:
output file will be opened and closed at each write action. 
at each write action it will be checked if it is necessary to open a new 
slowdata file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ListenToArduino/main.c

    r103 r104  
    117117
    118118        FILE *outfile;
    119         outfile = openOutfile(myPath);
    120        
    121         if (outfile == NULL) {return -1;}       
     119       
    122120
    123121        char outstring[400];
     
    133131            buf[res]=0;             /* set end of string, so we can printf */
    134132       
    135             if (strncmp (buf,"[Temp,",6) != 0) continue;
     133           
     134                if (strncmp (buf,"[Temp,",6) != 0) continue;
     135
     136                outfile = openOutfile(myPath);
     137                if (outfile == NULL) {return -1;}       
    136138               
    137139                time_t rawtime;
     
    160162            fprintf(outfile, "%s", outstring);
    161163            fflush(outfile);           
     164        fclose(outfile);
    162165       
    163166        if (poll_stdin_time(1500000)==1) {
     
    172175        /* restore the old port settings */
    173176        tcsetattr(fd,TCSANOW,&oldtio);
    174         fclose(outfile);
    175177
    176178return 0;
Note: See TracChangeset for help on using the changeset viewer.