#Help! Can't read char!
19-Jul-90 12:45:40
Sb: #113760-#Help! Can't read char!
Fm: Syndesis 76004,1763
To: Henry Williams 76416,377
First, check a good book on C and meditate on it. 🙂 'case' labels must
be an integer, character, or constant expression. That means you "ne" is
illegal. It's a string constant, which works like a pointer to char, which
means you could do a 'strcmp( str, "ne" )' and test that result. First,
you'd never get 'ne' as the result from a single scanf("%c", …) after
all, because it only grabs a single character. If you did an scanf("%s",
…) then you could get a string of characters, and then use a cascading
series of 'if (strcmp( str, "e" ) == 0) { … } else if (strcmp( str, "ne"
) == 0) { … etc. This might solve some of your problems… I'm not quite
sure what you meant by "goes right past", so I won't comment on that.