I want to run a custom file test.exe. I tried ShellExecute() and system(), but it did not work. How could i fix this?
code:
#include <stdio.h>
#include <windows.h>
int main()
{
system("C:\\Users\\user\\test.exe");
}
The code AND the next code system("PAUSE")
is skipped and does not return or make error during running.
I used errno code by answers and also does not treat the error.
It probably has test.exe in that directory and when I researched, that format is right and worked well in others.
It does not return anything, even -1 and shuts down.
I did check the task manager to see the program test.exe running and printing the Hello World(which is the right thing), but there was nothing.
ShellExecuteA
fails have you checked what error it actually returns? And forsystem
have you checkederrno
?if (system(...) == -1) { printf("Error running program: %s\n", strerror(errno)); }
test.exe
program supposed to do?