Thread: delting files

  1. #1
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259

    delting files

    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.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  3. #3
    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!!!!

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Yes, remove is safe. You should have the rights to delete the file of course.
    Why would it be unsafe?

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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.
    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.

    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.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 03:28 AM
  2. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  4. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  5. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 03:16 AM