PLUS+1 Tools > PLUS+1 and C

c code to write to the usb flash drive on DP7xx display

(1/1)

techn0:
I have used applog and that works fine but I want to have complete control over the arrangement of the saved CSV file so I am trying to write to the usb flash drive file from C

--- Code: ---if (BXPulse==true)
{
      FILE *file = fopen("usb:/data.csv", "w");
      int variable1=2;
      int variable2=4;
      int variable3=6;
      if (file != NULL) {
          // Write CSV headers
          fprintf(file, "Variable1,Variable2,Variable3\n");
 
          // Write data (replace with your actual variables)
          fprintf(file, "%f,%f,%f\n", variable1, variable2, variable3);
 
          // Close the file
          fclose(file);
      } else {
          // Handle error opening file
      }
}

--- End code ---
Using something like this.  I do not know exactly what to put in the fopen line.  Any help would be appreciated.

Thanks

Navigation

[0] Message Index

Go to full version