I am writing some properties in a ini file using WritePrivateProfileString
function and everything works fine but when I add text with multiple lines, there is a problem.
Here is the code and output.
WritePrivateProfileString(_T("General"), _T("Name"), OLE2CT(text), FilePath);
Output:
[General]
Name=mytext
.
text = address\nstreet\nhouse
WritePrivateProfileString(_T("General"), _T("Address"), OLE2CT(text), FilePath);
Output:
[General]
Name=mytext
Address=address
street
house
But when after adding a multiple line item, i add another item, instead of adding this to end it adds new line just after Address line
text = city
WritePrivateProfileString(_T("General"), _T("City"), OLE2CT(text), FilePath);
Output:
[General]
Name=mytext
Address=address
City=city
street
house
but the output should be
[General]
Name=mytext
Address=address
street
house
City=city
What is problem with my code?