How to delete a file?

This is a discussion on How to delete a file? within the C Programming forums, part of the General Programming Boards category; I need to delete a file from de hard disk. Like c:\example.txt Can anybody tell me how to do it? ...

  1. #1
    Registered User Seek n Destroy's Avatar
    Join Date
    Sep 2002
    Posts
    9

    Question How to delete a file?

    I need to delete a file from de hard disk.
    Like c:\example.txt

    Can anybody tell me how to do it?
    Thanxs
    Seek n destroy

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    you can make a system call and call rm, i think you use a pointer to the filename in this case
    Monday - what a way to spend a seventh of your life

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Code:
    //stdio.h:
    int remove(const char *filename);
    
    //example
    remove("old c project.c");

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 11:39 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 05:27 PM
  3. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 02:19 PM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 05:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21