print C codes from Solaris 10, x86 to cygwin on Windows?

Sorry, I meant to type "porting C codes from Solaris 10, x86 to cygwin in Windows"

I just installed cygwin 1.7 to my Windows PC.

I have a C program that compiles fine using gcc on Solaris 10, x86. This C program contains system calls like:

system ("ls -l > file.txt");

and

system ("cat file1 > file2");

I want to port my C codes from Solaris to Windows as easily as possible. On my first attempt, all of my source codes compiled in Windows, but when I run it, the compiled program hangs at these system calls. I had to press a <RETURN> for it to continue.

What's the easiest way to port a C program (with system calls) from Solaris 10, x86 into the cygwin environment in Windows? Thanks in advance.

Your system calls use unix shell commands. Windows only knows DOS commands in that context, for example:

ls -l > t.txt -> dir /s > t.txt

Do you mean that the calls to system() succeeded after you pressed <RETURN>?

Ugh.. well. You might try getting a BASH or ksh shell for windows, and calling it with system to do all those commands. Otherwise, you're going to have to rewrite a lot of code -- these C programs are almost shell scripts, the way they're written.