mercredi 18 mars 2015

Certain files won't open once transferred via FTP


I have a very basic console app which I've developed in C++-CLI. All the app does is transfers files to a ftp server. Each file gets transfered as required. I can open


.jpeg .png .gif


But when I try to open .docx or .xlsx I get the following error message


enter image description here


below is the relevant snippet of code



const int bufferLength = 2048;
array<Byte>^buffer = gcnew array < Byte >(bufferLength);
int count = 0;
int readBytes = 0;
FileStream^ stream = File::OpenRead(originalDirPath + e->Name);
do
{
readBytes = stream->Read(buffer, 0, bufferLength);
requestStream->Write(buffer, 0, bufferLength);
count += readBytes;
}
while (readBytes != 0);
Console::WriteLine("Writing {0} bytes to the stream.", count);


I can't seem to figure out where I'm going wrong




Aucun commentaire:

Enregistrer un commentaire