Question

  if(RS_ile==1) 
  { 
     if(RS_buf == 1)   break; 
     if(RS_buf==49)
     printf("1\n");
     else
     {

     printf("%d\n", RS_buf); 
     fprintf (fp, "%d\n", RS_buf);
      fclose (fp);
     }  
  } 

Everything work fine but all data was saved after I close my program. All I need is to put date to file while program is running not after closed.

Operating system Windows 8.1

Was it helpful?

Solution

Put a fflush(fp) ; after your fprintf.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top