Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Opening multiple files

Options
  • 23-01-2004 12:01am
    #1
    Closed Accounts Posts: 18


    Hi,

    I have a folder that contains a number of files with the same extension eg, *.txt. I want my program to open all these files.

    The program doesn't know the file names. I want the program to enter a loop and read in each file that has a specific extension.

    Is it possible to do this? I am using MS VC++ 6. Would suit best if it could be done using fopen and fread.


    Thanks in advance


Comments

  • Registered Users Posts: 2,150 ✭✭✭dazberry


    You need to iterate thru' the directory first to get all the matching files. Look up FindFirstFile and related calls in the WinAPI help or MSDN. Once you have the filenames you can open them with whatever method you choose.

    D.


Advertisement