Good morning all. Anyway, the code I have is in a class so it too long to past here, so I will have to explain. I am writing a hotel reservation system, as such it has a date header that is responsible for date and time.
The issue is that sometimes when i execute the program a out of range exception is thrown, and other times it is not, even though the same information is being entered to test for consistency. Also the substr always has the first argument set to 0. So unless the string does not exist, which I have already confirmed it does, these errors are illogical.
So are there any suggestions. And is there a way to find out which line my exception is being thrown from.
Line 359: string sub=val.substr(val.find(dateDelimeter)+1, (val.length()-(val.find(dateDelimeter)+1)));
If dateDelimeter is the last character in line will lead to exception. Alternatively depending on implementation can lead to exception if dateDelimiter is not found.