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. File in Append Mode

File in Append Mode

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 5 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?

    J CPalliniC H 3 Replies Last reply
    0
    • J john5632

      Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?

      J Offline
      J Offline
      Jhony george
      wrote on last edited by
      #2

      can u send ur code...so that i can get clearly.

      Born to win...!

      1 Reply Last reply
      0
      • J john5632

        Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?

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

        AFAIK CreateFile has no 'append' option: you have to go to the end of the file (via SetFilePointer) after opening it correctly for append (i.e. depending on your needs, with OPEN_ALWAYS or OPEN_EXISTING as dwCreationDisposition parameter) and start writing there. :)

        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.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • J john5632

          Hi, I created a file in append mode using CreateFile();.But if I reopen the file add add string to it, it is appending from the starting of the file. But it should be added from the end of the file. What is wrong?

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Do you need to CFile::Seek?

          N 1 Reply Last reply
          0
          • H Hamid Taebi

            Do you need to CFile::Seek?

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            Yes, he does ;)

            Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

            H 1 Reply Last reply
            0
            • N Nelek

              Yes, he does ;)

              Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              I think yes,Hi Nelek how are you.

              N 1 Reply Last reply
              0
              • H Hamid Taebi

                I think yes,Hi Nelek how are you.

                N Offline
                N Offline
                Nelek
                wrote on last edited by
                #7

                Fine thanks, a bit away of VC++ but trying not to forget :P I changed job and city.

                Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

                H 1 Reply Last reply
                0
                • N Nelek

                  Fine thanks, a bit away of VC++ but trying not to forget :P I changed job and city.

                  Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  I guess maybe you forgot me. ;)

                  N 1 Reply Last reply
                  0
                  • H Hamid Taebi

                    I guess maybe you forgot me. ;)

                    N Offline
                    N Offline
                    Nelek
                    wrote on last edited by
                    #9

                    No, I just forgot to check messages contents from forums notices :rolleyes: :laugh: ;P , just saved all and now that I had time... I have made clean up answering and keeping the ones I consider to be kept. It was a long time without coming to forums :P I will get more often so... see you in the posts ;):cool:

                    Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

                    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