470,572 Members | 2,642 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

reading strings into more than 1 array with if

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

if(command =="MOVETO")
{ filein>>value1[];

it doesnt seem to want to work and the compiler does like my use of == but i dont know why?!??!
Sep 2 '06 #1
1 1646
9,065 Expert Mod 8TB
What type is command?

Assuming that it is an array of characters

char command[50];

The the compiler wont be able to copy with

if ( command == "MOVETO" )

because there is no intrinsic comparison of arrays or any complex structure.

Look up and use the function

strcmp or strncmp
Sep 2 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Dietrich Epp | last post: by
24 posts views Thread by Hendrik Schober | last post: by
4 posts views Thread by Jeff Rodriguez | last post: by
21 posts views Thread by JoKur | last post: by
7 posts views Thread by John Dann | last post: by
18 posts views Thread by John | last post: by
10 posts views Thread by Tyler | last post: by
1 post views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
8 posts views Thread by omidsoltan | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.