[Interest] Return value from QProcess
Duane
duane.hebert at group-upc.com
Thu Apr 7 21:40:59 CEST 2016
On 07/04/2016 12:16 PM, Thiago Macieira wrote:
> On quinta-feira, 7 de abril de 2016 08:47:05 PDT Duane wrote:
>>>> /* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
>>>> #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
>>>
>>> BTW
>>>
>>> $ printf %x\\n 4531
>>> 11b3
>>>
>>> 0x11 is 17. So QProcess is correct.
>>
>> Thanks. Actually 4531 was a typo. It returns 4352 which is 1100.
>> So that explains it. std::system is returning it as an int. But then
>> again, QProcess::exitCode() is supposed to be returning it as an int as
>> well...
>
> It does and is correct. Both have correct return values.
>
> Your code dealing with system wasn't. You were supposed to use WEXITSTATUS on
> the int it returned to obtain the return code. From the system(3) man page:
>
> In the last two cases, the return value is a "wait status" that can
> be examined using the macros described in waitpid(2). (i.e.,
> WIFEXITED(), WEXITSTATUS(), and so on).
>
>
Ok thanks.
More information about the Interest
mailing list