Mail Archives: djgpp/1998/03/30/05:56:05
Wow, it could be the first time I CAN reply to a question (I'm only a
beginner...)
On Sun, 29 Mar 1998, Nicolas Blais wrote:
> Hi,
> Check the code below, can't figure out why this doesn't work, I mean,
> should it exit when I enter exit? Also, when I type spaces into my
> string, it creates as many ":" as I inputed spaces. Can anyone fix
> this?
>
> getcommand(void)
> {
> char *p;
> char *com;
> for (p = ":"; *p;p++)
> put_char(*p, 10);
> scanf("%s",com);
> if (strcmp(com, "exit") == 0) exit(0);
> getcommand();
> return 1;
> }
>
If you would allocate memory for com, you'll be able to put something in
it with scanf.
You can declare an array for com:
char com[22222222222222];
(is it big enough ?)
Well, I hope to be right...
federico
- Raw text -