CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Posts
    3

    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.

  2. #2
    Join Date
    Sep 2005
    Location
    United States
    Posts
    799

    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

  3. #3
    Join Date
    Dec 2006
    Posts
    3

    Re: File operation / manipulation

    Thanks for replying.

  4. #4
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    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?

  5. #5
    Join Date
    Dec 2006
    Posts
    3

    Re: File operation / manipulation

    I need the a simple source code of something like that so i can customize it for my own use.

  6. #6
    Join Date
    Sep 2005
    Location
    United States
    Posts
    799

    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
  •  





Click Here to Expand Forum to Full Width

Featured