im writing my own assembler and the only thing that is going wrong is reading the input from the source file I dont no how to read one word at a time so if i have a statement like
mov 25 3
it can read mov store it than 25 store it than 3 i just need the 3 or 4 lines of code to do that also should i store it in arrays or strings?

use fstream's >> operator to read just one word at a time.

but after i read that word how do i jump through the whitespace to the next one and how do i jump down a line when i need to.

fstream will skip white space for you -- you don't have to do a thing

ifstream in("filename");
string word;
int val1, val2;
while( in >> word >> val1 >> val2)
{
    // do something with these values
}

ok but how do i jump down a line in the file after i have read a certain amount of words.

The code I posted assumes three items on a line (a string and two integers). On every loop iteration fstream will read an entire line then go on to the next line, and keeps doing that until end-of-file is reached. If you are having problems grasping that concept then put a print statement inside the loop and run the code so that you can visually see what it is doing.

Its not possible to just skip lines -- the file has to be read sequentially from beginning to end.

ok now i have another little problem which I thought i could fix but its not working, everytime some data is put into my array i have to have it in sequential order so

int arrayDigit = 0;
binary[arrayDigit] = 198;

i want to use the value of arrayDigit to represent the element # in my array if u no what i mean, what should i do for this.
thanks in advance.

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.