In C how would i write an array to a file

  • Thread starter j-lee00
  • Start date
  • Tags Tags
    Array File
3 replies · 22K views · last reply
j-lee00
Messages
93
Reaction score
0
In C how would i create, open and write an array to a text file

The array is EeV,

does it make a difference if I am using ubuntu or windows
 
fopen() to open the file fwrite() to dump the data fread() to get it back.
The only differenc eon windows is you have to add a 'b' in the fopen() call to specify binary, ie fopen(filename,"wb") to open a file for writing.
 
I like to create a memory block containing all the data and the file header, and then just write the whole block to my hard drive.