Search code examples
cvisual-studio-2013command-line-argumentsvisual-studio-debugginglzma

How to pass multiple commands arguments in visual studio?


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.

Issue VS 2013

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.


Solution

  • The output was empty because I had put the file in the debug folder which is the same folder as the executable.

    However, when I put the file in the parent directory (or the solution folder), it finally worked.