I am very, very new to this C++, and i have been working on something that could help us with something, but thats a long story...

Anyways, i want the program to first delete a file then wait some time, and then delete another file. I got it to delete the files i wanted it to delete, but only if the files are in the same directory as the exe. I can't get it to wait either, i have been looking all around the internet, but i can't find anything that works. Can anyone help me plz?

thx :)

8 Years
Discussion Span
Last Post by Androggles

To delete files in other directories, you must provide path information.

An absolute path doesn't care where your executable is:


(Don't delete either of those, btw.)

A relative path is relative to the current working directory (which may or may not be where your executable is -- it is wherever the user started your program from).


If you started in (Windows) "D:\MyStuff" then the absolute path would be "D:\MyStuff\images\snoopy.png" or (Unix) "~/myprog/bin" then the path would be "~/myprog/objs/myprog.o".

To delay, use the Sleep() on Windows, or the usleep() function on POSIX.

Hope this helps.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.