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 <stdio.h> and <iostream.h>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<<label<<"\n"<<mnemonic<<"\n"<<operand<<"\n";

moved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.