![]() Registered Member ![]()
|
Can somebody please tell me how to work around this problem?
I'm working on a program that needs to be able to execute commands in a temporary file using /bin/sh. The problem is that temporary files made using KTemporaryFile vanish the moment I call exec. Since I need to know the name of the file I am using is all of the recommended subroutines in the C library are out of the picture as well.
RyanMcCoskrie, proud to be a member of KDE forums since 2008-Dec.
|
![]() Administrator ![]()
|
You need to keep the "KTemporaryFIle" object around, because objects created like below will be automatically cleaned up by the compiler when they go out of scope. When the KTemporaryFile instance is destroyed, the file will be deleted also.
You need to create the KTemporaryFile as follows:
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() KDE Developer ![]()
|
Or turn its "auto remove" feature off. See QTemporaryFile (its base class)
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]