From kde-devel Wed Jul 24 19:42:33 2002 From: aleXXX Date: Wed, 24 Jul 2002 19:42:33 +0000 To: kde-devel Subject: Re: Corruption in KProcess returned buffer X-MARC-Message: https://marc.info/?l=kde-devel&m=102753975314954 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::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 <<