Help needed in regarding to deletion of a file......

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • palani12kumar
    New Member
    • Oct 2006
    • 60

    Help needed in regarding to deletion of a file......

    Hi every body.
    i'd write a program to copy the content of one file to another file and to delete the content of the first file. But after deleting the first file remains the harddisk(even though it has no data in it). i want to remove the file totally from the harddisk. How to implement this. I'd written the program in C and the files that i want to delete is a ".txt" or ".doc" format files.
    please any one help me
  • DeMan
    Top Contributor
    • Nov 2006
    • 1799

    #2
    If you can see where it is, overwrite it with random data

    Comment

    • sivadhas2006
      New Member
      • Nov 2006
      • 142

      #3
      Originally posted by palani12kumar
      Hi every body.
      i'd write a program to copy the content of one file to another file and to delete the content of the first file. But after deleting the first file remains the harddisk(even though it has no data in it). i want to remove the file totally from the harddisk. How to implement this. I'd written the program in C and the files that i want to delete is a ".txt" or ".doc" format files.
      please any one help me
      Hi,

      Can u post u r code?

      Regards,
      M.Sivadhas.

      Comment

      • svsandeep
        New Member
        • Nov 2006
        • 15

        #4
        Originally posted by palani12kumar
        Hi every body.
        i'd write a program to copy the content of one file to another file and to delete the content of the first file. But after deleting the first file remains the harddisk(even though it has no data in it). i want to remove the file totally from the harddisk. How to implement this. I'd written the program in C and the files that i want to delete is a ".txt" or ".doc" format files.
        please any one help me

        Dude,

        I think you want to delete a file completely from the hardisk if i am not wrong.

        i hope you know the path of the file. here is the example

        #include <stdlib.h>
        void main()
        {
        system("del c:\\delme.txt") ;
        }

        Now you can pass any command you want to run (directly or as a string) to the system function.

        Regards,
        ShaggY@FtF

        Comment

        • palani12kumar
          New Member
          • Oct 2006
          • 60

          #5
          can you please tell me how the code works?

          #include <stdlib.h>
          void main()
          {
          system("del c:\\delme.txt") ;
          }

          In the line, system("del c:\\delme.txt") ;, whether the del is the dos command that we use?

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by palani12kumar
            can you please tell me how the code works?

            #include <stdlib.h>
            void main()
            {
            system("del c:\\delme.txt") ;
            }

            In the line, system("del c:\\delme.txt") ;, whether the del is the dos command that we use?
            yes, the parameter to system() is as though you were typing at the Command Prompt (the DOS prompt as it was called), e.g. you can
            Code:
            	system("dir *.c");
            to get a directory listing

            Comment

            Working...