Original Post
Ok, I am making a simple program to load a text file, parse it for certain info, and then do various irrelevant things.
I am using the Common Dialog Box function GetOpenFileName for obtaining the file name, then using MessageBox to notify the user of succes or failure of the file load. But MessageBox is displaying the wrong thing, for no good reason.
Now, I am explicitly telling the messagebox what to say, like this:
if(f_ptr == NULL) MessageBox(AppWindow, "Invalid File", NULL, MB_OK); else MessageBox(AppWindow, "File Loaded Sucessfully", NULL MB_OK);What is freaky is that when the program is run, the messagebox displayed does not contain "Invalid File" or "File Loaded Sucessfully". It contains the filename I selected in GetOpenFileName earlier in the program, except it chops it off at the first space. Thus if I load ''C:/My Documents/test.txt'' it displays ''Documents/test.txt'' in the messagebox. Other cases: If I click cancel and don''t load a file in the GetOpenFileName dialog box, I get a valid messagebox, saying "Invalid File". If the filename contains no spaces, I get an "Invalid File" message, even if I am as sure as possible that the file is valid. But I can''t debug that part till I know that my messageboxes are displaying what they should and what they should according to the program. I am guessing there is somthing about memory that is screwing up, but for the life of me I don''t know.