简体   繁体   中英

A Compiled .exe can't find input file

I have a compiled c code into .exe and can successfully execute the .exe in different locations by double clicking on it.

I am trying to use SAS to execute the .exe. There is error msg saying that the input file can't be found so .exe wasn't able to be executed appropriately.

I used Visual Studio to compile the c code. I am guessing it has something to do with how the code was compiled (such as the default directory where all the source and header files, and the input the file were saved at)?

Anyone can give me some ideas as for debugging and fixing the issue?

The SAS code used to call the .exe is pasted below and so is the error msg.

    x '"C:\Users\Gfish\Documents\Visual Studio 2010\Projects\M\Debug\M.exe"';

error image Many thanks!!

Gfish

The error msg in SAS after calling the .exe again using infile and pipe is attached as well (ie, error2) enter image description here

For debugging OS commands in SAS I always prefer to use infile with pipe - this way you can extract any error / debug messages and use them for conditional logic.

Try:

data _null_;
 infile '"C:\Users\Gfish\Documents\Visual Studio 2010\Projects\M\Debug\M.exe" 2>&1' pipe;
 input;
 list;
run;

Note the 2>&1 - this redirects STDERR to STDOUT (so you get both in the stream).

Also - as @Reeza mentions - try running this first on a regular command line. If it doesn't work there, it won't work in SAS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM