Home > Software engineering >  MFC ini file, read, write more rows of data
MFC ini file, read, write more rows of data

Time:10-02

Encounter a problem
I want to multi-line data is written into the ini file
Use WritePrivateProfileStringA,
With the GetPrivateProfileString read
By writing, single step debugging, access to data is multiline (contain newlines)
But read it out, is only the first line of data,
Please tell the great spirit

CodePudding user response:

Ini file is a fixed format, don't try to break its rules.

Ini file is a line a configuration, and to comply with the rules of grammar ini.

If you just want to customize the format of the text, reading and writing, then using the c standard library fopen fwrite fread correlation function.

CodePudding user response:

Yes, INI is design, so you can put a newline \ r \ n replace into other, write, read replace again after come back, but it is not convenient,
You write more rows of data is what things? Why do you want to save to the INI?
INI is designed to save the configuration parameters, and is not used to store data,
Written line by line, serialization, XML, JSON, SQLITE, there are many ways to save the data to a file

CodePudding user response:

So-called modify delete file a certain position, is actually read the open files, a then 'a position before the modification and deletion of content + a + modification and deletion of the contents of the content of the modify delete position after b' save to file, and close the file. A, deleting a file, the file b changed its name to the same as the before file a name, that's it,
http://bbs.csdn.net/topics/391975224