fopen / OPEN_MAX

Discussion in 'C++' started by Kushal Agarwal, Sep 17, 2004.

  1. 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
    Kushal Agarwal, Sep 17, 2004
    #1
    1. Advertising

  2. Kushal Agarwal

    Artie Gold Guest

    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).

    HTH,
    --ag

    --
    Artie Gold -- Austin, Texas

    20050120->44
    Artie Gold, Sep 17, 2004
    #2
    1. Advertising

  3. Kushal Agarwal

    Greg Comeau Guest

    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?
    Greg Comeau, Sep 17, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nonee
    Replies:
    2
    Views:
    2,637
    Neredbojias
    Oct 25, 2005
  2. Dave O'Hearn
    Replies:
    10
    Views:
    616
    Dave O'Hearn
    Nov 25, 2003
  3. Mister Zimbu
    Replies:
    2
    Views:
    516
    Mister Zimbu
    Oct 27, 2004
  4. fopen in specific environments

    , Aug 11, 2003, in forum: C Programming
    Replies:
    1
    Views:
    289
    Martin Ambuhl
    Aug 11, 2003
  5. Michel Rouzic
    Replies:
    4
    Views:
    1,823
    Michel Rouzic
    Apr 28, 2008
Loading...

Share This Page