Who said that QFile should always be on stack? Its depend on you whether you want to allocate in stack or heap.
Who said that QFile should always be on stack? Its depend on you whether you want to allocate in stack or heap.
Heavy Metal Rules. For those about to rock, we salute you.
HIT THANKS IF I HELPED.
QBuffer is the in-memory QIODevice you might want.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Then do coding in java, why r u here? Its depend on your program methodology. And if someone is here than atleast he should know the basic concept of c++(memory allocation). You shouldnt have to think about what they do with this code or if he /she will understand this code or not. Okay, point out the line that is causing memory leak in my code.
Heavy Metal Rules. For those about to rock, we salute you.
HIT THANKS IF I HELPED.
The simplest way to fix this without using delete it's just provide a parent in QFile's ctor.Qt Code:
... return; //memoy leak if a file can't be opened ...To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
No, simplest way is to say `QFile file;`, not `QFile* file = new ...`
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Bookmarks