Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file question

Status
Not open for further replies.

seiya1994

Programmer
Joined
Apr 1, 2006
Messages
3
Location
US
I have one file that contains the following information:
5 REM Calculating the n factorial, n!
15 PRINT " Enter a positive integer number:"
20 INPUT n
30 LET fact = 1
40 IF n <= 1 THEN 80
55 LET fact = fact * n
60 LET n = n - 1
70 GOTO 40
80 PRINT fact


Okay I want to get each individual line so I can push into a stack. However if I do this:

ifstream fin;
inpF.open("basic.txt");
string read;

while(!fin.eof())
{/***Read Line by Line until end of file***/
fin >> read;
if(!unRead.isFull()) unRead.push(read);
}

How can I read one line?
 
Take a look at the getline() function in the <string> header.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top