tags:

views:

271

answers:

2

I am unable to delete a mp3 file from C++ using remove(), neither can rename it using rename() function. What can I do to troubleshoot this?

+1  A: 

This file is most likely either open by another process (in which case you can find the process using it using ProcessExplorer, assuming you're on Windows), or the file/directory are read-only, or you don't have permissions to the file.

Solutions to either of these belong on either SuperUser for Unix or ServerFault for Windows, please re-post there with more details

DVK
don't suggest using a priviledge user, this is overkill for a simple file deletion and worse can be a security problem
dharga
He doesn't suggest using a privileged user, he is suggesting to post at the superuser.com or serverfault.com sites.
Aragorn
SuperUser for Unix? ServerFault for Windows? No, no, no. This is a programming question.
Thomas Owens
Why the down-vote?
DVK
@Thomas: the reason OP can't delete is file is probably OS related. Looks like the best we could do to answer that is to explain OP how to print errors as the library calls probably returns an error when it fails.
kriss
A: 

This file is most likely either open by another process? how come this is possible..?? my vlc player is off.

Rahul
Rahul: Reboot your computer.
Wadih M.
Rahul, before posting an answer, edit your question and read the comments of other users. For instance, related to the operating system and post some code!
Burkhard