input file error message
im having some difficulties with fstream and giving some specific error messages:
say for instance i have:
i need two error messages
1) to test if the file doesnt exist, print 'file does not exist'
2) if the file exist, but unable to be access (perhaps in read only mode)
ive been trying to work with in.fail() for if the file does not exist, but it also seems to work for #2.......is there any other ways of getting these two error messages?
1. you can use ios::nocreate and ios::noreplace ->
ios::nocreate -> wont create file, if file doesn't exists
ios::noreplace -> wont replace file, if file exists
2. use good/bad/fail -->
if(!in.good() || in.bad() || in.fail())