On saving configure paramters to disk file and read them into memory next time

  • Thread starter Thread starter hitbuyi
  • Start date Start date
H

hitbuyi

Guest
Naturely, I comp up with an idea that use a large structure to save it as *.dat file(binary file), using fwrite/fread to load and store. BUT this is not uncommon, I found some program uses *.ini file, and other uses xml file

so,

1) what's disavantage of .dat for using to save parameters? it's simple, using fwrite/fread only.

what's the advantage of .ini file and xml file to save parameter?

2) I write ONE structure data(4K data) to disk by using fwrite(), VS2015 failed, prompting me error of access violation, if I reduce the structure size to 1K, It is ok, so I guess it's matter of time taken to writing, question are here: how to judge if fwrite() is completed or not in case of writing only one data structure? code as below

FILE *fp;

fp = open("c.dat","wb");

fwrite(&myData, sizeof(my_data_t), 1, fp);








thanks a lot

Continue reading...
 
Back
Top