Kod który zwraca program wywoływany przez cmd

0

Cześć,

Ma ktoś pomysł, jak mogę uzyskać kod, który zwraca program wywoływany przez cmd (za pomocą funkcji system())?

Z góry dzięki za pomoc.

2

Nie da się zwrócić programu.
Możesz utworzyć strumień/potok/fifo za pomocą którego będziesz komunikował się z programem.
Tu przykład http://stackoverflow.com/questions/646241/c-run-a-system-command-and-get-output

1
int system (const char* command);

Generalnie ta funkcja zwraca Ci inta, który powinien być tym kodem.

Return Value
If command is a null pointer, the function returns a non-zero value in case a command processor is available and a zero value if it is not.

If command is not a null pointer, the value returned depends on the system and library implementations, but it is generally expected to be the status code returned by the called command, if supported.

source: http://www.cplusplus.com/reference/cstdlib/system/

0

Tak, to jest to. Dzięki. :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1