Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,147 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,086 people online right now. Registration is fast and FREE... Join Now!




When reading a file how do you get it to display another line?

 
Reply to this topicStart new topic

When reading a file how do you get it to display another line?, I/O Streams

hollsmeags
16 Apr, 2007 - 07:34 AM
Post #1

D.I.C Head
**

Joined: 29 Mar, 2007
Posts: 87


My Contributions
Im writing a program that has to read a file and create a inventory report

The read file is this

1234 1234 4321 12345
1234 4321 3212 3456
1234 5432 1234 4321


How do I read each line.
what I have so far is just one big line because "\n" is equivelent to whitespace not a new line!!!
please help
Thanks

I dont have any code yet, Im creating this all on paper first.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: When Reading A File How Do You Get It To Display Another Line?
16 Apr, 2007 - 07:37 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
http://www.cplusplus.com/doc/tutorial/files.html

User is offlineProfile CardPM
+Quote Post

Mickey
RE: When Reading A File How Do You Get It To Display Another Line?
16 Apr, 2007 - 07:57 AM
Post #3

New D.I.C Head
*

Joined: 11 Apr, 2007
Posts: 7


My Contributions
http://cplusplus.com/reference/string/getline.html

Would be the function you are looking for. to read in a full line at a time.

This post has been edited by Mickey: 16 Apr, 2007 - 07:58 AM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 10:53PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month