|
-
December 9th, 2006, 05:05 PM
#1
File operation / manipulation
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
Last edited by htlv; December 9th, 2006 at 05:23 PM.
-
December 9th, 2006, 05:13 PM
#2
Re: File operation / manipulation
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
Last edited by dcjr84; December 9th, 2006 at 05:17 PM.
Please rate my post if you felt it was helpful
-
December 9th, 2006, 05:23 PM
#3
Re: File operation / manipulation
-
December 10th, 2006, 12:12 AM
#4
Re: File operation / manipulation
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?
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
December 10th, 2006, 05:15 AM
#5
Re: File operation / manipulation
I need the a simple source code of something like that so i can customize it for my own use.
-
December 10th, 2006, 08:40 PM
#6
Re: File operation / manipulation
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.
Please rate my post if you felt it was helpful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|