hi,
I'm trying to read an integer value from file and I was wondering if I could use get function I wrote a simple code to understand how get function works but unfortunately I couldn't figure it out.so I need your help. Here is my simple code
But if I have more than 1 integer in the file how will the program understand where an integer starts and where it ends. I tried to put a certain cahracter like 'a' between each integer so when file.get() returns 97 program understands that a new integer starts but is there any other way? because the program should be able to retrieve the integer in the middle of the file
The example code I posted previously tests the character like this if (c >= '0' && c <= '9') at line 5.
As you can see, this loop will end when the character is not a digit. Commonly you would use a space or newline character to mark the end of the number. Though my code would also work with the letter 'a' because that is not a digit.
Oh ok I got it now:) thanks for the help bcoz although I used it in one of my earlier codes I just couldn't figure how to convert number of characters into integer I guess its bcoz I'm new and I have to practice a lot
anyways thanks again