954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Reading a text file

hi every one,
im working on a project which is the assembler of SIC language,im using a mixture of c and c++ functions in my c++ program by including and header files....
my problem is that im reading from file,this file contains the source code of SIC language...i want to read it line by line divide each line into tokens,,,,,i used strtok and it divided only the first line of the file,,i want to move to the next line,,,,i put a loop but it does not work,,,,,,,what shall i do,,,,,,,plz i nees an answer as soon as possible
the folowing is the part of code which divides only the first line:

fgets(string,100,source_code);
label=strtok(string," ");
mnemonic=strtok(NULL," ");
operand=strtok(NULL,"\n");


cout<

banan
Newbie Poster
1 post since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

moved

Ancient Dragon
Retired & Loving It
Team Colleague
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You