Mail Archives: djgpp/1999/07/24/00:25:36
Jon DeMarks wrote:
> I am trying to write a terminal that will get a command typed by the
> user and execute a function corresponding to it. Any suggestions? The
> following code snippet is stand-alone and can be compiled.
> #include <stdio.h>
> void _freedbgkern() { char buf[128];
> printf("\nFreedows Terminal v.1.0a By Jon DeMarks\n\n");
> for(;;) { fflush(stdin); scanf("%s", buf);
> if(buf=="sd") { sd(); }
> else { printf("Invaild command %s, come again?\n", buf); } } }
answering my own question here, but it might help somebody out: use:
if(strcmp(buf,"sd") { sd(); }
instead of: if(buf=="sd") { sd(); }
- Raw text -