On quarta-feira, 25 de setembro de 2013 23:04:42, Etienne Sandré-Chardonnal wrote: > I do not want to read first, I want to write data, close, then reopen for > reading (Used as a buffer for uploading large data over the network and > avoid keeping it in memory).
Once you close the file, your data is gone. Your data only exists as long as you keep the file open. Assuming well-behaved applications running on the system, you can open the file again in read-only mode, by using the same name. If you cannot assume well- behaved applications (and defensive coding says you shouldn't), reopening the file by name is not guaranteed to get the same data. You must pass the already- open file descriptor. Now, you can tell QTemporaryFile to abandon the file: that is, set auto deletion to false and then destroy the object. But like I said above, the file might be deleted and recreated by another application before you can reopen it again. In any case, every time you open a QTemporaryFile, you get a blank file. There is no data on the file, so it makes no sense to open it in read-only mode. If you want to open a file with existing data, created by something else, use QFile, not QTemporaryFile. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest