Hi, does anyone have an executable file or source code where i can perform such operations as delete, read, write, create, open on a file or folder by using the command prompt?
for example:
to delete a file
myprogram.exe delete file.txt
Printable View
Hi, does anyone have an executable file or source code where i can perform such operations as delete, read, write, create, open on a file or folder by using the command prompt?
for example:
to delete a file
myprogram.exe delete file.txt
As far as files go, you can do all of the above operations with standard C++. The only exception is deleting a file, which is OS dependent.
Have a look at this website for more information on reading, writing, creating, and opening files.
As far as directories go, there is no standard way to manipulate them in C++. You must use some external library to do so.
Have a look at boost::filesystem for doing such things. It supports almost all OS platforms, and is very useful :D
Thanks for replying.
Why do you need another application to do this stuff?
There are direct commands to do those stuff - mkdir, cd/chdir, rm/del/erase, and editors that will help you with editing the files.
Take a look at the windows commands - http://www.microsoft.com/resources/d....mspx?mfr=true
They are themselves programs that come with the operating system. Is this what you want?
I need the a simple source code of something like that so i can customize it for my own use.
Download and use the boost::filesystem that I showed you if you want a portable solution.
It's free, supports almost all OS platforms, and very easy to use.
If you just plan on using this in Windows, just follow exterminators advice and execute the built-in windows programs from within your code to do such things.