I am new to C++ programming under Windows. I am trying to execute a command say cuobjdump
in C++ code using the system()
function:
system("C:\\program files\\nvidia gpu computing...\\cuobjdump.exe --dump-cubin C:\\..\\input.exe");
output:
Usage : cuobjdump [options] <file>
This followed by the list of the options for cuobjdump.
When I execute this program I always get the cuobjdump help options displayed in the command line. It's as if the system call does not parse the filename. What am I doing wrong? I get the same result while using createprocess. The options --dump-cubin
gives an error as if I mistyped it.
System() Function in C/C++It is used to pass the commands that can be executed in the command processor or the terminal of the operating system, and finally returns the command after it has been completed. <stdlib. h> or <cstdlib> should be included to call this function.
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
system() is used to invoke an operating system command from a C/C++ program. int system(const char *command); Note: stdlib. h or cstdlib needs to be included to call system.
Give a try with (that is, surrounding cuobjdump.exe path with "
, properly escaped in C++ as \"
):
system("\"C:\\program files\\nvidia gpu computing...\\cuobjdump.exe\" --dump-cubin C:\\..\\input.exe");
system("cuobjdump --dump-cubin path\filename.exe");
That \f
is interpreted by the compiler as a string escape sequence, try path\\filename.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With