[GPGME] gpgme data buffer not showing any data
Marcus Brinkmann
marcus.brinkmann at ruhr-uni-bochum.de
Sat Jan 13 12:14:29 CET 2007
At Sun, 7 Jan 2007 01:15:18 +0000,
Garrett Kajmowicz <gkajmowi at tbaytel.net> wrote:
>
> I'm trying to push some data into a gogme_data_t buffer from an object and I'm
> not having any luck. The following code should return 8, but insted I'm
> getting -1. Please advise as to what I am missing.
http://gnupg.unixmexico.org/faq/gpgme-faq.html.de
Why does the function gpgme_data_seek not work?
You probably did not compile the program with largefile support. GPGME
is compiled with largefile support by default, so off_t is a 64-bit
data type. Because gpgme_data_seek uses off_t as a parameter type, you
have to compile your program with largefile support as well, so that
the data types used by GPGME and by your program match.
Note that you have to compile your program with largefile support even
if you do not use gpgme_data_seek, because file descriptors are
exchanged between the program and GPGME.
The GPGME documentation contains much more information on the
subject. See section 2.3 Largefile support of the GPGME Reference
Manual.
Thanks,
Marcus
>
>
> - Garrett
>
> #define D_FILE_OFFSET_BITS 64
>
> #include <gpgme.h>
> #include <string>
> #include <iostream>
>
> int main(){
> gpgme_error_t err;
> std::string msg("Message");
>
> gpgme_data_t In;
>
> err = gpgme_data_new_from_mem(&In, msg.c_str(), msg.length(), 1);
>
> if(err){
> std::cout << "An error occured copying data" << std::endl;
> }
>
> off_t len;
> len = gpgme_data_seek(In, 0, SEEK_END);
> std::cout << "Size of data: " << len << std::endl;
>
> return 0;
> }
>
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel
>
More information about the Gnupg-devel
mailing list