delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/24/00:25:36

From: Jon DeMarks <whatfor AT mindspring DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Terminal Programming
Date: Fri, 23 Jul 1999 23:38:06 -0400
Organization: Tachyeon Systems
Lines: 18
Message-ID: <3799351D.FC119898@mindspring.com>
References: <3798FE1B DOT AE7EEEC AT mindspring DOT com>
NNTP-Posting-Host: d1.8a.07.79
Mime-Version: 1.0
X-Server-Date: 24 Jul 1999 03:36:58 GMT
X-Mailer: Mozilla 4.04 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019