how to delete

This is a discussion on how to delete within the C++ Programming forums, part of the General Programming Boards category; How would I delete a file in C++ without using the system("DEL whatever"); ? Thanks, Machewy...

  1. #1
    Registered User Machewy's Avatar
    Join Date
    Apr 2003
    Posts
    42

    how to delete

    How would I delete a file in C++ without using the system("DEL whatever"); ?

    Thanks,
    Machewy
    "All things come to an end"

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    what OS?

    Win32 has DeleteFile()
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User Machewy's Avatar
    Join Date
    Apr 2003
    Posts
    42
    One for all Operating Systems
    "All things come to an end"

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    one reason in particular. maybe not in the delete case but in the general file access case. speed trials on the various windows API for file access produce astounding results. I ran c runtime vs WinAPI read and write trials where win32 API runs in 1/4 of the time that the c runtime does. Try it for yourself. Do clock checks after thousands of iterations on reading a file in each method.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    well then we're in agreement. breath..... slow the heart rate. it's good for you.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  6. #6
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    How would I delete a file in C++ without using the system("DEL whatever"); ?
    (in suspicious voice)...Somebody's making a virus!
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  7. #7
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Originally posted by Stan100
    (in suspicious voice)...Somebody's making a virus!
    Uhhhh.... yeah, okay..

  8. #8
    Registered User Machewy's Avatar
    Join Date
    Apr 2003
    Posts
    42
    NO! I am not making a virus!

    I am making a profile application!
    Got it!

    Anyways, can you help me find a way to remove files, directories, or whatever?
    Does the 'remove()' command work for deleting directories too?
    Can you guys find some way to do this?

    Thanks so much,
    Machewy

    P.S. People who make viruses to infect other people's computers are losers!
    "All things come to an end"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proper Usage of the delete Operator
    By thetinman in forum C++ Programming
    Replies: 7
    Last Post: 04-26-2007, 12:53 AM
  2. BST delete again, but this time I think I'm close
    By tms43 in forum C++ Programming
    Replies: 9
    Last Post: 11-05-2006, 06:24 PM
  3. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 02:52 PM
  4. why is this prog crashing on delete?
    By Waldo2k2 in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 11:17 PM
  5. Problem need help
    By Srpurdy in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2002, 01:45 PM

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