Hallo , ich hab ne ähnliche problem,
ich will ein binäre datei lesen und in eine Datenbank speichern , aber von 2724b liest nur 59 b !
if(!(fp = fopen("file.p12", "rb"))) {
cout <<"Error reading file.\n";
return -1;
}
long lSize;
char * buffer;
size_t result;
// obtain file size:
fseek (fp , 0 , SEEK_END);
lSize = ftell (fp);
rewind (fp);
// allocate memory to contain the whole file:
buffer = (char*) malloc (sizeof(char)*lSize );
if (buffer == NULL) {cout << "Memory error\n"; return -1;}
// copy the file into the buffer:
result = fread (buffer,1,lSize ,fp);
if (result != lSize) {cout << "Reading error\n"; return -1;}
fclose(fp);
// buffer in DB schreiben ....
Kann jemand helfen ?
Danke !