Reading into an array from datafile.

I have a datafile that looks like this:

1
2
3
4
5
6
7
8
9
NOT       11010011
ADD       00001101  00110011
ADD       11111111  00000001
OR        10011001  11100101
AND       10010010  11001110
CONVERT   10010110
LSHIFT    11001101  3
RSHIFT    11001101  3
WRONG     01010100  10101010


The first column are function names that I need to do on the following 8 bit numbers. I am capturing items in the first column by using an input>> functionName where I've declared functionName as a type string and input as a ifstream object.

The issue I'm having is I have to capture the 8 bit numbers as an array. I'm not sure what function I need to do this with.

for example here is how I'm capturing the first part

1
2
3
4
5
6
7
8
9
10
11
void BitPattern::ReadBitPattern(ifstream& inFile){

		string function;
		inFile >> function;
		cout << function;

		if ( function == "NOT"){
			Operation_NOT();		
		}

}


I'll then use if statements to grab what function I need to perform, but I am lost as to how to make the Operation_Not() function read the next 8 bit number into an array (its required).
Use getline() to capture the whole line and then parse it with stringstream.
Topic archived. No new replies allowed.