Great question Yusuf! :-) I would suggest checking the file permissions. For example if the file is read-only, then we won't be able to remove the file.
it may sound really really silly, but at first you need to fclose() the file before deleting it. i spent an hour trying to find out why it wasnt working :c
Running it on Ubuntu and compiling with gcc In did not have to include stdlib.h. If I check man remove I see it is in stdio.h. So I do not have it clear in which situations we need to actually include stdlib.h? Or maybe this is just a system specificity?
You should be able to use it to delete files in other directories, like the example here: pubs.opengroup.org/onlinepubs/007904975/functions/remove.html. Technically it will delete the file in the "current working directory" which should be the directory you run the compiled program in.
hello, i have a fileon windows 10 and the code gives me error 13 - permission denied, any ideas how i can fix that ?
Great question Yusuf! :-) I would suggest checking the file permissions. For example if the file is read-only, then we won't be able to remove the file.
it may sound really really silly, but at first you need to fclose() the file before deleting it. i spent an hour trying to find out why it wasnt working :c
Running it on Ubuntu and compiling with gcc In did not have to include stdlib.h. If I check man remove I see it is in stdio.h. So I do not have it clear in which situations we need to actually include stdlib.h? Or maybe this is just a system specificity?
So, would this function only delete files that are in the same folder as the code, or can it delete ANY file on your computer?
You should be able to use it to delete files in other directories, like the example here: pubs.opengroup.org/onlinepubs/007904975/functions/remove.html. Technically it will delete the file in the "current working directory" which should be the directory you run the compiled program in.
@@PortfolioCourses Great! Thank you!
You're welcome! :-)
Thank you!
A great voice, holy
Thank you very much Cristhian! :-)