io - How to write an array to file in C -


i have 2 dimensional matrix:

char clientdata[12][128]; 

what best way write contents file? need update text file on every write previous data in file cleared.

since size of data fixed, 1 simple way of writing entire array file using binary writing mode:

file *f = fopen("client.data", "wb"); fwrite(clientdata, sizeof(char), sizeof(clientdata), f); fclose(f); 

this writes out whole 2d array @ once, writing on content of file has been there previously.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -