Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

[C++] Printing a whole text file in separate lines

text file printing separate lines

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 qyler

qyler

    CC Newcomer

  • Member
  • PipPip
  • 19 posts

Posted 01 February 2013 - 07:07 PM

I am writing a program and have gotten half of the way there, but I could use some help on the last 50%. I have a function that allows a user to input a line and then it sends it to a text file. Each inputted member is sent to the text file on a new line. This is working fine, I am having trouble with the read function. This is supposed to read the whole text file and print it to cout. The only way I know to do this is to use getline() to send it to a string, but this only does one line. What other way can I do this?


- The things that go to those who wait, may be taken by those who got their first

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 01 February 2013 - 07:29 PM

You could read this tutorial about writing and reading files in c

 

For the rest, please paste your code here so we can see how can we help you



#3 qyler

qyler

    CC Newcomer

  • Member
  • PipPip
  • 19 posts

Posted 02 February 2013 - 08:36 PM

Thanks! I figured it out using that tutorial.


- The things that go to those who wait, may be taken by those who got their first




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download