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. Beginner problem c++

Beginner problem c++

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++jsonquestionlearning
3 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.
  • B Offline
    B Offline
    begzz
    wrote on last edited by
    #1

    Problem c++ Hi i have an txt-file that looks like this: Bigman arnold :line1 1333131313131 :line2 blue 123 green 2, 234 green :line3 arctic 34 :line4 The thing i have to do is modify the out put from the txt file. There are many more lines. I have to modify it so the output from the files so it becomes like this: arnold Bigman :line1 blue 123 green 2, 234 green :line 2 arctic 34 :line3 1333131313131 :line4 And the lines continues for the rest of the txt file. I'we been trying ifstream with a while(file>>string1>>string2>>getline(zzzzz, file) But i get an error im totally of. Sometimes there are only 3 lines for the adress and sometimes 4. Any good ideas?

    D L 2 Replies Last reply
    0
    • B begzz

      Problem c++ Hi i have an txt-file that looks like this: Bigman arnold :line1 1333131313131 :line2 blue 123 green 2, 234 green :line3 arctic 34 :line4 The thing i have to do is modify the out put from the txt file. There are many more lines. I have to modify it so the output from the files so it becomes like this: arnold Bigman :line1 blue 123 green 2, 234 green :line 2 arctic 34 :line3 1333131313131 :line4 And the lines continues for the rest of the txt file. I'we been trying ifstream with a while(file>>string1>>string2>>getline(zzzzz, file) But i get an error im totally of. Sometimes there are only 3 lines for the adress and sometimes 4. Any good ideas?

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

      So are you needing to know how to read from one file and write to another, how to swap strings, or something else? I see no pattern in your input/output (e.g., line 1 swaps the two words, line 2 moves to line 4). :confused:

      "One man's wage rise is another man's price increase." - Harold Wilson

      "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

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      1 Reply Last reply
      0
      • B begzz

        Problem c++ Hi i have an txt-file that looks like this: Bigman arnold :line1 1333131313131 :line2 blue 123 green 2, 234 green :line3 arctic 34 :line4 The thing i have to do is modify the out put from the txt file. There are many more lines. I have to modify it so the output from the files so it becomes like this: arnold Bigman :line1 blue 123 green 2, 234 green :line 2 arctic 34 :line3 1333131313131 :line4 And the lines continues for the rest of the txt file. I'we been trying ifstream with a while(file>>string1>>string2>>getline(zzzzz, file) But i get an error im totally of. Sometimes there are only 3 lines for the adress and sometimes 4. Any good ideas?

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

        begzz wrote:

        But i get an error

        We cannot guess what error you get. Please edit your question, show the actual code you are using, the error that you get and where in the code it occurs.

        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