I have a 2 dimensional array which holds vectors of floats, its pretty big and i need save and restore this from disk.
Is there an easy way to do this other than reading it in and out of text files?:confused:
Cheers
Andy
Printable View
I have a 2 dimensional array which holds vectors of floats, its pretty big and i need save and restore this from disk.
Is there an easy way to do this other than reading it in and out of text files?:confused:
Cheers
Andy
use fread() fwrite() to write a binary file.
Code:FILE *out;
float **arr;
... fill up your array with data
out=fopen("myfile.dat","wb");
fwrite(arr, sizeof(float), numberofelements, out);
fclose(out);
// to get it back -
out=fopen("myfile.dat","rb");
fread(arr,sizeof(float), numberofelements,out);
fclose(out);