Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Opening multiple files

  • 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, Registered Users 2 Posts: 2,157 ✭✭✭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