December 24, 200718 yr I've been writing a program which reads a bunch of text strings in from a file, and selects one to match the user input string. When i directly stored these strings in my program, i got an invalid page fault (that means my program is tryin to access memory not allocated to it). To remedy this problem, i instead used the tellg() function before i read each string and stored the result. ( the tellg() function retrieves the input stream's get pointer) This would allow me to call seekg() later and getline from there so i could read in the value at that location. (when i say getline, I mean the string version, not the member function) Problem is, when i call seekg(), it sets it at a different location! It most certainly does not do what i want it to. Can anyone enlighten me as to how the seekg() function works so i can get it to read the location i originally stored. (if you haven't realized yet, this is a programming question.) This is where they want I should sign?
Create an account or sign in to comment