I've got a project that can make use of a user-specified configuration file to modify aspects of its behavior. I'm developing on a POSIX platform, so it's just a simple text file that is stashed in the user's home directory (i.e. ~/.configfile, standard Unix behavior).
This program is written in almost completely portable C, so it builds fine on Windows, at least with MinGW. However, I'm unfamiliar with how Windows handles user config files, so for the time being the program simply looks in the current directory for a file called progname.ini. I'm sure this is not ideal, so I'm looking for the best place, on Windows, to store a configuration file.
I realize Windows has a registry, but I'm only interested in using a flat file, mainly because this program is firmly rooted in POSIX and it would require a lot more non-portable code to change this behavior, something I'm not interested in. So, given this (presumably less-than-ideal) constraint, how should I go about figuring out what directory this configuration file should go in?
For reference, the program has a small OS-dependent collection of functions, and this particular function is required to simply return a string containing the name of the preferred configuration file; so right now it's just return "progname.ini";