From: Pascal DOT Obry AT der DOT edfgdf DOT fr (Pascal OBRY) Subject: strange problem with popen !! 5 Feb 1998 14:33:24 -0800 Message-ID: <043D134D9BC3600B*/c=fr/admd=atlas/prmd=edfgdf/o=der/ou=der-ccmail/s=Obry/g=Pascal/.cygnus.gnu-win32@MHS> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: "gnu-win32 AT cygnus DOT com" (Return requested) (Receipt notification requested) I have the following program that run an executable (via popen) and read the stdout of this program. The problem is that it does not work when linked with MINGW32 configured to use MSVCRT40.DLL. But it does work when linked with MSVCRT20.DLL. BTW it works too with VC !!!! Does somebody what could be the problem ? Pascal. ---------- cut here ---------- file : tryit.c #include #define SIZEBUF 1000 int main (void) { FILE *FD; char buffer [SIZEBUF]; char *buf; printf ("runme...\n"); FD = popen ("runme paramx", "r"); if (FD == NULL) printf ("error: FD=NULL\n"); else printf ("FD=%d\n", (int)FD); printf ("get...\n"); buf = fgets (buffer, SIZEBUF, FD); if (buf == NULL) perror ("error fgets"); printf ("<1>%s\n", buf); } ---------- cut here ---------- ---------- cut here ---------- file : runme.c #include int main (int argc, char *argv[]) { fprintf (stderr, "output to stderr\n"); if (argc > 1) printf ("line 1 - to be read (%s)\n", argv[1]); else printf ("line 1 - to be read\n"); fprintf (stderr, "output to stderr\n"); printf ("line 2 - to be read\n"); fprintf (stderr, "output to stderr\n"); exit (0); } ---------- cut here ---------- ---------- cut here ---------- the output output to stderr output to stderr output to stderr error fgets: No error runme... FD=2013522008 get... <1>(null) ---------- cut here ---------- --|------------------------------------------------------------ --| Pascal Obry Team-Ada Member | --| | --| EDF-DER-IPN-SID- G A L A X I E | --| Intranet: http://cln49ae | --| Bureau N-023 e-mail: pascal DOT obry AT der DOT edfgdf DOT fr | --| 1 Av Général de Gaulle voice : +33-1-47.65.50.91 | --| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 | --| FRANCE | --|------------------------------------------------------------ --| --| http://ourworld.compuserve.com/homepages/pascal_obry --| --| "The best way to travel is by means of imagination" - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".