PDA

View Full Version : Function call with QFile as parameter?



Pyry
25th May 2011, 14:01
What is the right way to do this? I need to pass QFile object to function which writes some data to file. I've tried to search example code but no success.

meazza
25th May 2011, 14:04
void function(QFile *file);

And pass your object pointer to that function. That will make it possible to edit it.

ChrisW67
26th May 2011, 01:10
... or for a C++ flavour, as a non-const reference to the QFile object.

void writeToFile(QFile &file) { ... }
...
QFile test;
...
writeToFile(test);