[prev] [index] [next]

The fwrite function (cont)

Examples (dump several data structures):

FILE *outf;
int array[50];
struct { float x; float y; } point;
// ... set values in array[] and point

outf = fopen("myDataFile","w");

// ... write array to file
fwrite(array, sizeof(int), 50, outf);

// ... write struct to file
fwrite(point, sizeof(point), 1, outf);