[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Corruption in KProcess returned buffer
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2002-07-24 19:42:33
[Download RAW message or body]

On Wednesday 24 July 2002 20:55, Colin Desmond wrote:
> I am trying to capture the Stdout from a process run through KProcess.
...
> The buffer being returned and displayed is corrupted, here is an example:
>
>                0.00    0.00     8íÿ¿¢ 327/601319
> vnl_diag_matrix<double>::operator()(unsigned int, unsigned int) [9]
>                                        ^^^^ corruption
>
> This occurs at various points throught the string (this example is 8248
> bytes long, although buflen is 1024)

Do you mean the resulting string is 8248 bytes long, but buflen is only 1024 ?

Then the data you receive in buffer is not 0-terminated, so you can't simply 
assign it to a string. Use something like memcpy() or 0-terminate it 
manually.

Bye
Alex

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic