Jump to content

Problems with the C++


slayernm613

Recommended Posts

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?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.