Mail Archives: djgpp/1999/03/18/12:01:00
From: | Jorge Pacios =?iso-8859-1?Q?Mart=EDnez?= <jpacios AT gmv DOT es>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Tcl/Tk and C interaction problem
|
Date: | Thu, 18 Mar 1999 17:26:12 +0100
|
Organization: | GMV
|
Lines: | 50
|
Message-ID: | <36F12924.A1AD5AA6@gmv.es>
|
NNTP-Posting-Host: | luisa.esegi.es
|
Mime-Version: | 1.0
|
X-Trace: | hardy.gmv.es 921774380 3563 194.74.161.194 (18 Mar 1999 16:26:20 GMT)
|
X-Complaints-To: | usenet AT news DOT gmv DOT es
|
NNTP-Posting-Date: | 18 Mar 1999 16:26:20 GMT
|
X-Mailer: | Mozilla 4.5 [es] (Win95; I)
|
X-Accept-Language: | es
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I have compiled the following dummy program with DJGPP gcc:
-----------------------------------------------------------------------
# include <stdio.h>
# include <string.h>
void readcommand (char *str) {
char ch;
int i = 0;
read(0, &ch, 1);
while (ch!='\n') {
str[i] = ch;
i++;
read(0, &ch, 1);
}
str[i] = '\0';
}
void main (void) {
char prompt [] = "\necho> ";
char cmd [1000];
printf("%s", prompt);
fflush(stdout);
readcommand(cmd);
while (strcmp(cmd, "quit") != 0) {
printf("%s", cmd);
printf("%s", prompt);
fflush(stdout);
readcommand(cmd);
}
}
-----------------------------------------------------------------------
As everybody can see, it just reads input and echoes it,
displaying a prompt.
I am willing to make a Tcl/Tk interface to this program,
sending strings to it and reading its output (I open the program with
a pipe). The problem is, I always get blocked when trying to read from
the pipe.
...I have compiled the *same* program with the gcc program
provided by gnat-3.09-nt --a cygwin.dll based compiler, I think-- and
the interface works perfectly.
Maybe a buffering problem?
Thanks,
J. Pacios
- Raw text -