Message-Id: <200312092230.hB9MUbUI030901@delorie.com> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Luis Torres" To: "cygwin AT cygwin DOT com" Date: Tue, 09 Dec 2003 22:31:52 +0000 Reply-To: "Luis Torres" MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Subject: Different behaviour of "test -f" under cmd and bash, when called from compiled App Hello, While experiencing difficulties running a Java applicaton that calls shell + C processes, compiled using Cygwin tools I posed or perhaps ill-posed a question regarding the use of Java. I think I might eventually solve my particular problem if I understand 2 points, which I think this m-l may help clarify: 1) I would like to know if this is true: A process (*.exe file using dynamic libraries or not, compiled using gcc ) and called from Java will behave properly as long as that process called from the cmd.exe shell in W2K also works OK. That is I assume that the Java Virtual machine when processing something like this Runtime.getRuntime().exec("cmd /c myprocess.exe "); will not generate java.io.IOException: CreateProcess: error=2,3 2) In relation to the above I tracked the following problem. If I use (interactive shell): test -f AfileIKnowExists && echo YES (under either cmd.exe or Cygwin/bash), I get the correct answer (test.exe from /cygdrive/c/cygwin/bin as per official distribution) while if I use the code bellow within a program.exe compiled under Cygwin, I get the correct answer if I use it within bash but NOT the correct answer if I use the program in cmd.exe Code : " strcpy(command,"test -f "); strcat(command,fpath); if(verbose) fprintf(stderr,"Executing %s\n", command); if(!system(command)) return 1; else return 0; " the path, by the way is: /cygdrive/c/BHPViewer/demo/data/proj1/seismic/taranaki_frac_0000.HDR. /cygdrive/c/ replaced by c:/ gives same results in all cases. Is this normal?. What is the possible reason?. How to fix?. Could it be a problem?. I used Unix-style in the install which is much better for exchanging files with other Unix machines. Thank you for your help. Regards, Luis -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/