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. delete a line from file.

delete a line from file.

Scheduled Pinned Locked Moved C / C++ / MFC
6 Posts 6 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.
  • S Offline
    S Offline
    sam_psycho
    wrote on last edited by
    #1

    Hi All, I'm using CStdioFile to read a file line by line, I want to delete line 5,6,9 from the file. Plz give me hint or soln.. thax :)

    _ 1 Reply Last reply
    0
    • S sam_psycho

      Hi All, I'm using CStdioFile to read a file line by line, I want to delete line 5,6,9 from the file. Plz give me hint or soln.. thax :)

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You can either write the lines to another file without writing the lines you want to delete. Then delete the original and rename the new file with the original name. Or you could store all the required lines in memory and overwrite the original file.

      «_Superman_» I love work. It gives me something to do between weekends.

      L 1 Reply Last reply
      0
      • _ _Superman_

        You can either write the lines to another file without writing the lines you want to delete. Then delete the original and rename the new file with the original name. Or you could store all the required lines in memory and overwrite the original file.

        «_Superman_» I love work. It gives me something to do between weekends.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        me sathish first take the contents of the file using FILE* like c funtions gradually turn to next line ,meanwhile to store a static value if the pointer goes to downwards if reached 456 write " " ie empty text there ...

        ya

        I CPalliniC 2 Replies Last reply
        0
        • L Lost User

          me sathish first take the contents of the file using FILE* like c funtions gradually turn to next line ,meanwhile to store a static value if the pointer goes to downwards if reached 456 write " " ie empty text there ...

          ya

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          sathish / satheesh, You need to reply to the original poster, not the helper. The original poster will be more interested in your assistance. Iain.

          Codeproject MVP for C++, I can't believe it's for my lounge posts...

          1 Reply Last reply
          0
          • L Lost User

            me sathish first take the contents of the file using FILE* like c funtions gradually turn to next line ,meanwhile to store a static value if the pointer goes to downwards if reached 456 write " " ie empty text there ...

            ya

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

            me carlo go straight forward until you reach the first crossroad with traffic lights, then turn left and straight forward to the next crossroad with traffic lights where you will take the left turn and then make a turn on first available street on your right. Go straight forward down the street and at the end, on your right you'll see the hotel. :)

            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
            [My articles]

            In testa che avete, signor di Ceprano?

            D 1 Reply Last reply
            0
            • CPalliniC CPallini

              me carlo go straight forward until you reach the first crossroad with traffic lights, then turn left and straight forward to the next crossroad with traffic lights where you will take the left turn and then make a turn on first available street on your right. Go straight forward down the street and at the end, on your right you'll see the hotel. :)

              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
              [My articles]

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

              Makes perfect sense to me, although I question why you opted to turn down that one street.

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              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