Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

i have code which is writing and reading the ini files as per expected.
But what i have just noticed is that if any (value of key) under section contains too log character it get break into two or more line if character length is greater than 50.
And this brings error while reading the file because the value of Description key is broken and goes beyond another section. So please help me over come this issue..


Thanks
Jeetendra


VB
[Main]
Enable=True
RecipientCount=2
PrinterName=Test
Description=Desc Test 31 JulyTest 31 JulyTest 31 JulyTest 31 JulyTest 31 July
ParseReports=2
EntryDate=
Test 31 JulyTest 31 JulyTest 31 JulyTest 31 July
Test 31 JulyTest 31 July
[Report]
User1=Client 
Posted
Comments
ZurdoDev 31-Jul-14 15:52pm    
Why is it breaking to the next line?

Simple: stop using INI files.
They are very out of date: there are much more flexible configuration file systems in use now, and have been since INI file startes to go out of mass use with Win95 and teh Registry...

Look at Settings.Settings[^] for example.
, or XML files instead.
 
Share this answer
 
Stop using INI files. One good alternative is this: http://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx[^], and the XML serializer based on the Data Contract.

One of the minor consequences of using XML will be rendering your "line breaking" problem totally irrelevant: XML delimiting is not related to end-of-line characters, which may or may not be there and not lost in data.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900