I've browsed www.rt.com/man/ looking for a function to remove files with and I found http://www.rt.com/man/remove.3.html , what I wounder is, is it safe to use this function, it looks to me as if it's used wrong one can screw up quite badly...
I've browsed www.rt.com/man/ looking for a function to remove files with and I found http://www.rt.com/man/remove.3.html , what I wounder is, is it safe to use this function, it looks to me as if it's used wrong one can screw up quite badly...
They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.
It's safe if what you want to do is remove files
It's unsafe if what you wanted to do was calculate PI
Of course you can make a big mess if you're completely reckless with your coding.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
why would you want to delete a file in a program?
seems a bit risky.
personally, i would include the rm in either the makefile or from the command line.
DrakkenKorin
Get off my Intarweb!!!!
Yes, remove is safe. You should have the rights to delete the file of course.
Why would it be unsafe?
You do realize that when you delete a file in your nice little GUI, that that is in fact a program deleting a file. Or, all those nifty file manager programs you install for X or what not, that allow you to move files or delete them, those are in fact programs that are deleting files. As a matter of fact, the shell you're running, is a program that has capability to delete files. Remember Windows 95? Windows 3.1? Windows 98? Those were all programs running on top of DOS, which had the capability to delete files.why would you want to delete a file in a program?
seems a bit risky.
personally, i would include the rm in either the makefile or from the command line.
We could go on and on with this sort of thing, but the point is, there are lots of reasons to delete a file. C provides a way to do that. I mean, it would be pretty lousy if you could only create files and never delete them.
Quzah.
Hope is the first step on the road to disappointment.
>I mean, it would be pretty lousy if you could only create files and never delete them.
The storage makers would love it, but you'd have a mess in a hurry. Maybe you could do a backup every so often, reformat the disk, and start over.