Thread: Remove File

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    44

    Remove File

    Code:
    /* NOME PROGRAMMA   : WIN ERASER
       TEAM DI SVILUPPO : MFT
       CODERS           : KRAKZ (PER ADESSO)
       LICENZA          : GNU\GPL
       VERSIONE         : 0.0.0.1 ( NON FUNZIONANTE )
    */
    # include <stdio.h>
    
    main ()
    { 
    FILE *eraser ; /* puntatore al file ERASER.dat */
    
    eraser = fopen ("erase.dat" , "w"); /* CREA IL FILE ERASE.DAT */
    int remove (const char *eraser) ; /* TEORICAMENTE CANCELLA IL FILE ERASER MA INVECE NON FUNZIONA */
    remove("eraser.dat") ;
    }

    int remove (const char *eraser)

    this function, would have to cancel the rows eraser.dat, but it does not cancel it knowledge to say to me like never?
    http://linuxdesktop.it

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Code:
    #include <stdio.h>
    
    int main(void)
    {
    	remove("eraser.dat");
    	return 0;
    }
    Make sure this program is run in the same directory as eraser.dat.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    44
    THx

    and i delete a directory

    EX:

    C:\windows\temp


    what ????
    http://linuxdesktop.it

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    I'm not sure exactoly but I believe you ahve to delete every file in it first (including files in subdirectories and the sub directories) and then just called remove("C:\windows\temp\");

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    44
    scume orbitz can i example for me ????
    http://linuxdesktop.it

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Code:
    removedir(dirname)
    	read file name ins
    	if file is a dir
    		removedir(filename)
    	else
    		remove(filename)
    Windows has it's own API for foreading in filenames, but in *NIX look for opendir, readdir, closedir.

  7. #7
    Registered User
    Join Date
    Dec 2002
    Posts
    44
    scusami se sono un po tardo ma puoi fare l esempio eliminando la cartella temp che si trova sotto la cartella win ????


    C:\windows\temp

    excuse me if they are a little late but you can make l example eliminating the folder temp that search under the folder win?


    C:\windows\temp
    http://linuxdesktop.it

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    No, I don't write programs for people unless they give me something as a reward.

    I understand that you do not speak english very well, but that should not stop you from thinking and solving a problem.

  9. #9
    Registered User
    Join Date
    Dec 2002
    Posts
    44
    ok thx

    however thanks for l ' aid
    http://linuxdesktop.it

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, 10:39 PM
  2. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM