Date: Mon, 30 Mar 1998 12:36:25 +0200 (MET DST) From: Federico Spinazzi To: Nicolas Blais cc: djgpp AT delorie DOT com Subject: Re: Why won't this work? In-Reply-To: <351E8C26.2608F112@netrover.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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