Codice: Seleziona tutto
unsigned int y=0;
ifstream fin(path, ios::binary);
if (fin) {
fin.seekg(0, ios::end);
ios::pos_type bufsize = fin.tellg(); // get file size in bytes
char* buf = new char[bufsize];
int x = bufsize;
while(x>200){
fin.seekg(y);
fin.read(buf,200);
sftp_write(file, buf,200);
y=y+200;
x-=200;
}
sftp_write(file, buf,x);
}
funziona, e' un po' lento, ma funziona