•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,423 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,601 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 1241 | Replies: 1
![]() |
•
•
Join Date: Apr 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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";
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";
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- C++ Reading from a text file (C++)
- Help with a 2D array from a text file (C++)
- read text file (C)
- Reading in a text file string is not complete (Pascal and Delphi)
- reading txt file into array (C++)
Other Threads in the C++ Forum
- Previous Thread: Assistance with change program
- Next Thread: Help with function



Linear Mode