From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: Terminal Programming Date: 24 Jul 1999 07:53:40 GMT Organization: University of Lulea, Sweden Lines: 21 Message-ID: <7nbre4$am$1@news.luth.se> References: <3798FE1B DOT AE7EEEC AT mindspring DOT com> NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Jon DeMarks (whatfor AT mindspring DOT com) 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 : 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); } } } fflush(stdin) results in undefined behaviour. Don't do that. (Another minor observation is that it compilable, but not linkable (and thus not runable) (sd() undefined).) Kokkonen, Symphony No. 4, MartinS