I have an arbitrary number of files whose names I will know and I want to open them for reading. The important point is that I do not want to open them sequentially using a single file pointer. I need to have them all open at the same time. This suggests using and an array of file pointers, where this is declared to be of dimension N, where N is the maximum number of files I can have open.

A quick trawl of the web has not brought anything up and it's not in my textbooks. Being a relatively infrequent C-programmer, I'm not at all sure about setting up and using arrays of file pointers. What is the declaration syntax and how is it used? (Or is there another/better way to do what I want?)

If you know how to use arrays, and you know how to use FILE pointers, you know how to use arrays of FILE pointers. There's really nothing tricky about it except for the number of files you can have open at any given time. The FOPEN_MAX macro in stdio.h tells you how many streams are guaranteed to be open simultaneously. Note that this number includes the standard streams that are already open. Size your array accordingly.

Edited 7 Years Ago by Narue: n/a

This question has already been answered. Start a new discussion instead.