Ok so in my program it's supposed to load names from a file and i wanted to make soem error handling in case the file was empy or missing so i did, however the if statement for checking if the file is empty doesnt seem to be working, when i run my program the cmd box displays really strange symbols and starts beeping, so what am i doing wrong?
Are you sure "customer names.txt" is really a plain text file? You didn't save it with Word, did you? Open it in Notepad to be sure it really is plain text.
Let's see the file then, or part of it anyways.
Also, doesn't this seem a bit silly?
Line 9: if(loadCustomerNames.fail())
...
Line 13: elseif(!loadCustomerNames.fail())
Same goes for lines 18 and 22.
That's your problem - the .fail() state is only set when you try to actually read something, not when you just open a blank file or read the last byte.