添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

    Problems with ifstream::seekg and tellg

    Forum Search Links
    I'm writing a program that requires multiple passes over a file. I've created a file input stream and when i need to save a spot i use
    streampos seekPosition = fin.tellg();
    This returns the proper seek position. later when i use
    fin.seekg(seekPosition);  it does not go back to the proper spot in the file, in fact it stays at its last spot or the one before it in the file. This is only a problem in Microsoft Visual C++, does anyone know a way around this in Visual C++ or why it only happens with MSVC++?

    Red Flag This Post

    Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

    Red Flag Submitted

    Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
    The Tek-Tips staff will check this out and take appropriate action.

    Reply To This Thread

    Posting in the Tek-Tips forums is a member-only feature.

    Click Here to join Tek-Tips and talk with other members! Already a Member? Login

    Join Tek-Tips ® Today!

    Join your peers on the Internet's largest technical computer professional community.
    It's easy to join and it's free.

    Here's Why Members Love Tek-Tips Forums:

  • Tek-Tips Forums Talk To Other Members
  • Notification Of Responses To Questions
  • Favorite Forums One Click Access
  • Keyword Search Of All Posts, And More...
  • Register now while it's still free!

    Already a member? Close this window and log in.