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]

system() not working outside of Cygwin environment


Hi all,

Perhaps this is very basic but I was not able to find the answer in faq/docs.

Attached is a nice small program which does system("cmd /?"); The call
works pretty well when I run it from Cygwin environment. In my
situation I need to run standalone Cygwin programs (i.e. simply from
Windows cmd.exe). In this case the program fails - system() does not
seem to find cmd.exe and returns -1 (yes, cygwin1.dll is on PATH). If
I change system() to good old CreateProcess() everything runs fine. My
questions:
1) what is the reason for this behavior?
2) can I somehow alter the argument to system() to make it working? Or
perhaps modify PATH or any other environment variable before running
Cygwin program?

Thanks in advance,
Yuri

Attachment: gcc.txt
Description: Text document

--
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]