Jens Nixdorf wrote:
Am Donnerstag, 13. März 2008 schrieb Jens Nixdorf:
int rc=0; rc=system("pump -i eth0");
Das hat nicht funktioniert, weil in rc eine 5 erscheint. Der nächste Versuch war mit dem Makro WEXITSTATUS:
So, da habe ich mich schön selber verarscht. Wenn man das Programm immer aus der IDE heraus startet, und dabei automatisch der Debugger läuft, dann bekommt man eben nicht die richtigen Rückgabewerte. Ohne Debugger schon. Hmpf.
Du solltest aber trotzdem WEXITSTATUS() auf den Rückgabewert anwenden. Aus der Manpage: The value returned is -1 on error (e.g. fork(2) failed), and the return status of the command otherwise. This latter return status is in the format specified in wait(2). Thus, the exit code of the command will be WEXITSTATUS(status). In case /bin/sh could not be executed, the exit status will be that of a command that does exit(127). If the value of command is NULL, system() returns non-zero if the shell is available, and zero if not. system() does not affect the wait status of any other children. HTH, Bernhard --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming-de+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming-de+help@opensuse.org