How to pass multiple commands arguments in visual

2019-05-21 22:14发布

问题:

I am working on a compession/decompression project using the LZMA SDK.

The main program contains some arguments that I must use to run the application

To run it from the command line, I use :

./LzmaUtil.exe e input.elf output.elf

I'm using VS 2013 , so i have added e in.elf out.elf to the commands arguments, I rebuild the project (the executable file in generated) but nothing seems to happen when I press RUN.

Note that I have the input.elf in the debug folder were the .exe is present there, and the , the flag e is used to compress the file and output.elf is the compressed file.

The main function contains :

int MY_CDECL main(int numArgs, const char *args[])
{
    char rs[800] = { 0 };
    int res = main2(numArgs, args, rs);
    fputs(rs, stdout);
    return res;
}

The complete source code is available at : http://www.7-zip.org/sdk.html

Debugging :

With no arguments at all I get :

The program '[5284] LzmaUtil.exe' has exited with code 0 (0x0).

With the arguments I have mentionned I get :

The program '[5284] LzmaUtil.exe' has exited with code 1 (0x1).

so something is happenning !!!

With breakpoint at the main I get :

numArgs 4   int
args    0x007eaca8 {0x007eacbc "E:\\1PFE\\LZMA\\LzmaUtil\\Debug\\LzmaUtil.exe"} const char * *

Any help will be appreciated, thanks.

回答1:

The output was empty because i have put the file in the debug folder , it in the same folder of the executable.

But when i put the file at the parent directory (the solution folder) it finally worked .

That's how visual studio works !.