fopen / OPEN_MAX

I need to use fopen to open a whole bunch of files, however I
discovered that I am limited in the number of simultaneous file
handles that can be opened by the constant OPEN_MAX. I tried to
modify this constant, but it appears to be compile time set, therefore
my changes are not reflected. I was wonder if anyone knew how I can
modify this constant?

Additionally, does anyone also know what other functions/procedures
may utilize the constant OPEN_MAX?

I do realize that there are other ways to open files, but for the
project I am working on it is most practical to use fopen.

Advertisements

Kushal Agarwal wrote:
> Hello,
>
> I need to use fopen to open a whole bunch of files, however I
> discovered that I am limited in the number of simultaneous file
> handles that can be opened by the constant OPEN_MAX. I tried to
> modify this constant, but it appears to be compile time set, therefore
> my changes are not reflected. I was wonder if anyone knew how I can
> modify this constant?
>
> Additionally, does anyone also know what other functions/procedures
> may utilize the constant OPEN_MAX?
>
> I do realize that there are other ways to open files, but for the
> project I am working on it is most practical to use fopen.
>
> Thanks,
>
> Kushal

Tnis is an implementation/system issue, not a language issue.
Posting to a newsgroup that concerns itself with your platform would be
more fruitful (hint: it's likely there's nothing you can do about this
from user space).

Advertisements

In article <>,
Kushal Agarwal <> wrote:
>I need to use fopen to open a whole bunch of files, however I
>discovered that I am limited in the number of simultaneous file
>handles that can be opened by the constant OPEN_MAX. I tried to
>modify this constant, but it appears to be compile time set, therefore
>my changes are not reflected. I was wonder if anyone knew how I can
>modify this constant?
>
>Additionally, does anyone also know what other functions/procedures
>may utilize the constant OPEN_MAX?
>
>I do realize that there are other ways to open files, but for the
>project I am working on it is most practical to use fopen.

Dunno what OPEN_MAX is, but whatever the constant is,
you may be stuck, since it may be constrained by things
like the OS won't let have a process have any more open
files than that value. I've been on systems where that
value was smaller than the per process value, and
could be changed if you had the source to the C compiler's
runtime library. I know this may be easier say that one,
but you may want to see if some of the files can be closed,
or combined, put in shared memory, etc.
--
Greg Comeau / Comeau C++ 4.3.3, for C++03 core language support
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!