GpgmeData value

Werner Koch wk@gnupg.org
Wed Sep 25 13:41:01 2002


On Wed, 25 Sep 2002 07:15:04 GMT,   said:

I assume:

  char resultText;

> while(!(err = gpgme_data_read ( out, buf, 100, &nread
> ))){
>  resultText+=buf;
> }

You are not using it correctly:

/* Read LENGTH bytes from the data object DH and store them in the
   memory starting at BUFFER.  The number of bytes actually read is
   returned in NREAD.  */
GpgmeError gpgme_data_read (GpgmeData dh, void *buffer,
			    size_t length, size_t *nread);

So adding the pointer BUF to RESULTTEXT won't yiled any useful
result.  I don't know waht you want to do, maybe something like:

char *p, *resultText;

p = resultText = xmalloc (large_value);
while(!(err = gpgme_data_read ( out, buf, 100, &nread))){
   /* fixme: check that resulktText is withing bounds */
   memcpy (p, buf, nread);
   p += nread;
}

But this is pointless, as you can just pass resultText and its
allocated size to gpgme_data_read.


Salam-Shalom,

   Werner