سؤال

FILE * pFile = fopen("C:\\Penguins.jpg","rb");
fseek( pFile, 0, SEEK_END );
int Size = ftell( pFile );
fseek(pFile,0,SEEK_SET);
zmq::message_t newmessage ;
memcpy((void*)newmessage.data(),pFile,Size);
requester.send(newmessage);
fclose(pFile);

Memcpy() out with Access violation (parameters: 0x00000008). What to do? I tried a lot!

هل كانت مفيدة؟

المحلول

You will need to replace the memcpy with:

  fread((char *)(newmessage.data), 1, Size, pFile);

نصائح أخرى

If you want to copy the file with memcpy, you need to memory map the file. Since you didn't memory map the file, you need to read it with, say, fread.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top