The code is incomplete it need like 9 num variables but I cant get the current ones to display.
When I added "C:\\Users\\Jazmin\\Documents\\Fall2013\\CIS-17C\\animaldossier.txt" it wont even tell me its unsuccessful. Animaldossier.txt contains just some animal information. How would I fix my file to open and also read the information correctly. Any help would be much appreciated.
____________________________________________________________________
The >> operator expects you to know which data type to use for a specific access to the file. That means if you attempt to read an integer it expects to parse digits.
But the text in front of the numbers messes with the parser, so the return value is 0.
There is not really a simple way to separate the number from the text, at least not by a method of the ifstream class. (Not that I know of)
You have to read the whole line and extract the number manually.
Have a look at the string class that might help with parsing the string and functions like strtok() and stoi().
Hes right in that ifstream can't do it I think. However it would be easier imo to do a stringstream because then you have more control of whats in the buffer and what ur grabbing