Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. tellp, tellg, seekp, seekg

tellp, tellg, seekp, seekg

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    clint1982
    wrote on last edited by
    #1

    Hi I've used files long time ago in C++. I guess there is a certain new convention for using files in Visual C++ 2005, I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg. Is there any new class which I should use or any other method ? I want still to work unmanaged not using the functions of system.dll which are used in .NET. Thanks, Clint

    D 1 Reply Last reply
    0
    • C clint1982

      Hi I've used files long time ago in C++. I guess there is a certain new convention for using files in Visual C++ 2005, I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg. Is there any new class which I should use or any other method ? I want still to work unmanaged not using the functions of system.dll which are used in .NET. Thanks, Clint

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      clint1982 wrote:

      I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg.

      What do you get? Expect?

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      C 1 Reply Last reply
      0
      • D David Crow

        clint1982 wrote:

        I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg.

        What do you get? Expect?

        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        C Offline
        C Offline
        clint1982
        wrote on last edited by
        #3

        well, I write bytes into a file, I seek to the end of the file and call (tellp or tellg) after flushing the stream, and get 2 as an answer. But if I close the file, I see that the size of the file is 188. So I expect that the answer would be 188. Clint

        CPalliniC 1 Reply Last reply
        0
        • C clint1982

          well, I write bytes into a file, I seek to the end of the file and call (tellp or tellg) after flushing the stream, and get 2 as an answer. But if I close the file, I see that the size of the file is 188. So I expect that the answer would be 188. Clint

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          Usually these functions work well. Can you post the relevant code? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups