Overview
Features
Download
Documentation
Community
Add-Ons & Services

FileAccessDenied exception

Please post support and help requests here.

FileAccessDenied exception

Postby tnarol » 08 Nov 2007, 16:25

Hi,

I have to delete a file if it exist so my code is something like :

File fileDest(filePath);
if (fileDest.exists())
{
try
{
fileDest.remove();
}
catch (...)
{
}
}

While running this code under Windows with an existing file I enter the 'exist' condition but the remove function throws a "FileAccessDenied" exception.If I break the program at this point and try to delete the file manually from the explorer it works. So why could I if Poco cannot ?

Thanks
tnarol
 
Posts: 22
Joined: 21 Mar 2007, 18:56
Location: France

Re: FileAccessDenied exception

Postby guenter » 10 Nov 2007, 18:31

Not sure why this happens. Most probably, the file is currently opened by another application. But this does not explain why the Explorer can delete the file. Try stepping into the remove() function and find out what's the Windows error code.
guenter
 
Posts: 1119
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron