Need Help in Handling Multiple Files

This is a discussion on Need Help in Handling Multiple Files within the C Programming forums, part of the General Programming Boards category; Hi Guys. I want to Write A Program by Which I can Add my NAME in end of All ".txt" ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72

    Smile Need Help in Handling Multiple Files

    Hi Guys. I want to Write A Program by Which I can Add my NAME in end of All ".txt" Files Present in a Folder. If i know the name of the .txt file(s) then its easy by using fopen(). But how to Open all the files for appending when I don't Know the name of any File Which is Present in that Folder..???
    I drop the IDEA of Finding the Names First and Then appending.. because it increases the Complexity of The Program..
    Need Help. ^_^
    OS: Windows XP
    Compiler: BC++
    Last edited by Gaurav Singh; 05-15-2011 at 02:31 PM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok... you will need to use #include <windows.h> and look up the usage of
    SetCurrentDirectory(), FindFirstFile() , FindNextFile() and FindClose() on msdn.

    There is an example here...

    This will let you get the file names from a single folder one at a time so you can do your thing on them...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Source Files, make files, scope, include
    By thetinman in forum C++ Programming
    Replies: 13
    Last Post: 11-05-2008, 10:37 PM
  2. Handling multiple input files from command line
    By cnfwriter in forum C Programming
    Replies: 13
    Last Post: 08-25-2008, 08:07 AM
  3. Exception handling framework based on multiple inheritance
    By Mario F. in forum C++ Programming
    Replies: 11
    Last Post: 06-25-2007, 10:17 AM
  4. multiple file handling
    By sloke in forum C Programming
    Replies: 2
    Last Post: 11-18-2005, 11:55 AM
  5. Replies: 1
    Last Post: 05-01-2003, 02:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21