popen () fails when running from the windows prompt
Andy Koppe
andy.koppe@gmail.com
Fri Jul 15 19:22:00 GMT 2011
On 15 July 2011 19:41, Luiz Claudio Valdetaro wrote:
> i,
>> I am planning a minimalistic installation of my application using cygwin.
> Everything works fine, except that popen() fails when running from the
> windows prompt.
>> If I ran from the bash shell prompt of cygwin , it works fine. It is the
> only api I use that is failing. I created a simple, test program to narrow
> the issue, and it also fails.
>> my intention is an installation with just my app, plus the cygwin.dll, as
> little files as possible.
>> This is my test program:
>> main (argc,argv)
> int argc;
> unsigned char *argv[];
> {
> FILE *f;
> char command[80]="ls -l CGI-BIN";
> char response[200];
> f = popen (command,"r");
> if (f == NULL) {
> puts ("stream error");
> exit (0);
> }
> while (fgets(response,199,f) != NULL) {
> puts (response);
> }
> fclose (f);
> }
>> The program allays fails printing "stream error"
It's because popen() requires /bin/sh.
Andy
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list