bool CheckExistence(char* filename)
{
// I want the program to check if a file with the name filename exists in the
// directory I specify.
}
I am working on this and the save and load functions, but I don't know how to check if the file exists in the directory.
Alternately (and, honestly, preferably), I would like to make the function display all the files in the directory with a certain extension so the user can pick which file to save/load.
Also it looks like you're trying to mimic this function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646928(v=vs.85).aspx
This function opens a "save file" dialog (you can provide your own filter for the files, e.g. *.fil), asks for confirmation upon overwrite - so the usual dialog you see when trying to save file in just about any software.
It depends on what kind of application do you develop. Perhaps you use Qt and then you should use QFileDialog for that purpose: http://doc.qt.nokia.com/4.7-snapshot/qfiledialog.html . If you make a WinAPI software - use the file dialog provided by WinAPI. If you work in Linux - then, well, certainly this functionality is already implemented - just search for it.
To be honest, I don't remember - it's been a while since I used WinAPI directly. But as far as I remember MessageBox did work, so I assume this one will too - your program doesn't need to process any windows messages itself. Just try it out :)