PDA

View Full Version : How to get reference to a file?



zgulser
20th June 2012, 13:10
Hi,

I have a process that creates a file in the application path. I need to get a reference to this file in order to flush or close it.

Making only;



QFile myFile(nameOfTheFileIwantToRefer);


would be enough?

wysota
20th June 2012, 13:37
Not really sure what you mean. You can't flush or close file opened by process A from within a different process B.

zgulser
20th June 2012, 15:09
Hi again,

I mean I'm opening a file from another dll. aFter a while I want to access this file ( somewhere at D: ) via QFile in order to flush it.

wysota
20th June 2012, 15:31
Then you need to get the exact same handle from that dll. Opening a new handle (through QFile) won't help.

Ali Reza
20th June 2012, 20:06
use QDataStream and setDevice() function in it.
Hopes help you !

wysota
20th June 2012, 20:31
use QDataStream and setDevice() function in it.
Hopes help you !

Tell me Ali Reza, why would using QDataStream help anything here?

Ali Reza
21st June 2012, 07:32
by setDevice function, we can manage an IO device such as read specific bytes
If i underestand correctly.
:-)

wysota
21st June 2012, 08:31
such as read specific bytes
Is that what this thread is about?

Ali Reza
21st June 2012, 08:38
oh
excuse me sir.
my post did not related.
excuse again ...