Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I had and old batch file that I used to delete any file on my computer of the same name:
--DelFile.bat--
@ECHO OFF
FOR /F "TOKENS=*" %%F IN ('DIR /AD /B /S') DO DELETE %%F\Trash.txt
--DelFile.bat--Recently, I've been trying to update most of my batch files to C++. I have figured out how to translate most of my other files in C++, but i cant figure out how to establish all of the folders on the computer. Any ideas?

To delete a file in open C++ code, you should just be able to, e.g.:
std::remove("abc.txt");
That assumes:
#include <cstdio>
#include <cstdlib>For the directory sweep, you will need to revert to basic C stuff, directory manipulation is not provided by the C++ libraries. The routines required are defined by:
#include <dirent.h>
It provides necessary definitions for 'opendir', 'readdir', etc .....
For more information, and example code see:
http://www.informit.com/guides/cont...
Guy

![]() |
Cannot install VB Express...
|
silent cmd shell from vbs...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |