om471987 om471987 - 5 months ago 26
Ini Question

Read ini file which does not have any section?

My ini file does not have any section. It has following data

I want to use function.

private static extern int GetPrivateProfileString(string section,
string key,string def, StringBuilder retVal,
int size,string filePath);

My problems

  1. I cannot give section name in the function because I dont have any

  2. If I give section name null, it returns nothing

  3. I don't want to use brute force like ReadAllText


Here's a library that the author says supports section-less keys. I myself have not tried this library.
Or, you could simply edit the Ini file and add in a "header"/section name right at the top, then delete it once you're done reading.