Dear all,
I'm writing a client/server application in which the client can send a file
to the server. At the client side, my code is something like below:

QFile fl(file_name);

fl.open(QIODevice::ReadOnly);

QByteArray fileBytes = fl.readAll();

socket->write(fileBytes);

fl.close();

And at the server side, the code that receives the file is something like this:

QByteArray data = client_socket->readAll();
QFile fl(file_name);fl.open(QIODevice::WriteOnly);fl.write(data);fl.close();

While the code above works well with text files, it does not work for
other file types (like JPG and PDF files). What is the problem? How
should i modify the code so that it works for all kinds of files?

Thanks.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to