Don't double-post. You asked the identical question last week in the Newbie section.

Not only that, but you have been given answers and advice on how to handle these serial communications several times already in your previous posts. Go back and re-read those posts and you will see that in every case, you need to design a system that queues up a set of commands, executes one of them, waits for a successful reply, then executes the next until the queue is empty.

It does not matter if you read the complete file into a buffer or read and send the file in chunks. The point is that however you decide to do it, you need to implement the handshaking protocol between your PC and your device that allows you to send the information in the sizes the device wants, wait for it to tell you it is ready for the next chunk, send it, and repeat until there are no more chunks. You can't do this in a single function with a loop; you have to implement an event-driven system where you send, wait for a reply, and send again, based on the signals issued by the serial port.

Qt's file I/O mechanisms have all of the signals and slots needed to accomplish this. Qt has many example projects for serial port communication. This one looks like it is applicable to your problem.