This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: popen () fails when running from the windows prompt


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]