anyone knows how to resolve this problem?

I have a C program in UNIX that contains system calls, something like this:

system (“ls -l > file”);

I installed cygwin and this C program compiled OK on a Windows XP machine. When I go to run it at the cygwin shell, the C program hangs at this system call. To continue, I have to press a carriage return. If not, the C program just hangs.

How can I go around this problem in Windows when I use cygwin?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wild guesses…

It’d be nice if you had a bit more information about what did or did not
work. For example, once you press [Enter] on your own does the output
from your app look like this call was made properly? If so we can rule
out a path issue or something silly like that (this call requires that
‘ls’ be in the $PATH, which is probably is normally). Does it work with
some other command? Does it work if you are not redirecting output to a
file? Perhaps watch the cygwin process with something like filemon (in
windows) or strace (from within cygwin, assuming it is available) to see
what this call is doing in there. With a little luck you’ll see why it is
failing. I would almost wonder if it could be some kind of line-ending
issue but that would be weird considering the way this call is formatted
since there is no newline or carriage-return in it.

Good luck.

newbie09 wrote:
> I have a C program in UNIX that contains system calls, something like
> this:
>
> system (“ls -l > file”);
>
> I installed cygwin and this C program compiled OK on a Windows XP
> machine. When I go to run it at the cygwin shell, the C program hangs
> at this system call. To continue, I have to press a carriage return.
> If not, the C program just hangs.
>
> How can I go around this problem in Windows when I use cygwin?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJKdD5lAAoJEF+XTK08PnB5Q0IQAMEHOePgzcGenRRKn4xU0jMI
/BjHEis1oW8jfvP23Yx7tr1qXWEfe6UNhk+igOfrjrh5paZTV3qqMoBEZRvdh4jG
ORcrxg2cUFoaGlbWJit/OtjbAYk7c7Rl75EQl+g6seDWPtgWpL2T8gH0+eyjUza6
KTRxSpDwNbMqUS/P+Va3FnIUreZUjJSVniS3gwLaFCGyDPtHVJ6lSp7AYy/IpBzX
5pocQo9nPBRmle87oKzkNfFgZVjhbVuC98jnvNgTJ28sLeuMh6L3iWMW/uoH9ulW
9L9T3YlXVE/2V6ylm3dnKAPaU6qzLqNk5gldYIREomcbyo+oSJdpUR5p+vdOgFSb
yJPILUylEmiGaqGcPYilaO7wKyUYIm+ySUfo19BUbW/jPaeooAx3HzIpaaeo2JUM
bNJZKeoqybtgbj1MU5HBW+o89N456VQ6T6Nc3Wh5dnm0ZT4OY7ucDmXveFQ3U/3g
7tViujs46EIFX7A5rQzGpLjfv+fgaq9jqZwqq6tL0NoOuLb5rGU+0ylezRHPa/0A
zbTESaJyoBEND+5ZyrAFRQk+fL9Sp4/lYNQkedZhvISas1kjOAQDxp5uiEHQetA5
c1JFr8ZnDG23256lXYVlEVHv8Cg+XXkhvQarruAdA9OsE/PYFAYAV9yVUzDBkwKY
hB0Mu8dVFy2jlWtckARu
=TEd8
-----END PGP SIGNATURE-----