Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to read multi line in an ini file

Status
Not open for further replies.

ferrari123

Programmer
Feb 9, 2003
22
IN
Hi ,
I have an ini file which i read using GetPrivateProfileString. It takes CRLF as string termination. Is there any way through which i can get multi strings ?

thanks & regards
~ Rudresh

 
MSDN:
Code:
DWORD GetPrivateProfileString(
  LPCTSTR lpAppName,        // points to section name
  LPCTSTR lpKeyName,        // points to key name
  LPCTSTR lpDefault,        // points to default string
  LPTSTR lpReturnedString,  // points to destination buffer
  DWORD nSize,              // size of destination buffer
  LPCTSTR lpFileName        // points to 
                            // initialization filename
);

If lpAppName is NULL, GetPrivateProfileString copies all section names in the specified file to the supplied buffer. If lpKeyName is NULL, the function copies all key names in the specified section to the supplied buffer. An application can use this method to enumerate all of the sections and keys in a file. In either case, each string is followed by a null character and the final string is followed by a second null character. If the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters.

Or better read .ini file (as a text) and parse it by hand (it seems it's not so hard;)...
 
You can't store mulilined strings in an .ini unless you first replace the Cr/Lf with another char (for example '|'), and when you read it back replace that char with Cr/Lf




/Per
[sub]
www.perfnurt.se[/sub]
 
Hi Arkm , Per,

thanks a lot. Looks like i have to parse it on my own.

thanks & regards,
~ Rudresh


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top