views:

540

answers:

2

Are comments allowed in Windows ini files? (...assuming you're using the GetPrivateProfileString api functions to read them...)

[Section]
Name=Value   ; comment

; full line comment

And, is there a proper spec of the .INI file format anywhere?

Thanks for the replies - However maybe I wasn't clear enough. It's only the format as read by Windows API Calls that I'm interested in. I know other implementations allow comments, but it's specifically the MS Windows spec and implementation that I need to know about.

+2  A: 

I have seen comments in INI files, so yes refer to the Wikipedia article at http://en.wikipedia.org/wiki/INI_file, there does not seem to be an official specification that I could find, but that is the correct syntax for comments, as many Game INI files had this as I remember.

Edit

The API returns the Value and the Comment (forgot to mention this in my reply), just construct and example INI file and call the API on this (with comments) and you can see how this is returned.

RoguePlanetoid
A: 

Yes,

Have a look at Wikipedia and Spec (See bottom of page.

Koekiebox
Um... what makes you think that this is the authoritative spec on INI files?
Reuben
Yes, the spec link isn't really very helpful.
Roddy