hello, i need to read in commands from a text file. Once the first line is read into an array if it is a certain word then a certain amount of numbers are read into another array. i have been using
filein>>array[size];
if(command =="MOVETO")
{ filein>>value1[];
filein>>value2[];
}
etc
it doesnt seem to want to work and the compiler does like my use of ==...
User Profile
Collapse
-
reading strings into more than 1 array with if
-
command is type string as is the array:
string command;
string patternarray[100]; -
Hello,
the below is a segment of code from my program and is part of a switch statement case1:
cout <<"Enter the name of the pattern file you wish to load: " << endl;
cin >> patternfile;
filein.open(pat ternfile.c_str( ));
if(filein.good( ))
{
filein>>firstwo rd;
while (firstword =="PATTERN")
{
filein>>pattern array[command];...Leave a comment:
-
Hello,
the below is a segment of code from my program and is part of a switch statement case1:
cout <<"Enter the name of the pattern file you wish to load: " << endl;
cin >> patternfile;
filein.open(pat ternfile.c_str( ));
if(filein.good( ))
{
filein>>firstwo rd;
while (firstword =="PATTERN")
{
filein>>pattern array[command];...Leave a comment:
-
Reading commands into an array from a text file
Hello,
I need to read in commands from a text file into an array and i just can't do it. I am trying to use the line filein>>pattern array[command];
and it doesn't work! can anyone help me?
Cheers
No activity results to display
Show More
Leave a comment: