|
Boost : |
From: John Torjo (john.lists_at_[hidden])
Date: 2004-04-16 01:16:44
Jody Hagins wrote:
>I know that C++ IOStreams are supposed to take over the world, and
>cstdio with FILE is considered taboo by some C++ efficionados. However,
>due to many reasons, lots of code still uses cstdio FILE I/O. One issue
>that comes up from time to time is the need to manage more files than
>the OS will allow a single process to have open simultaneously. I
>process tons of data, and this is an issue for me. I have developed a
>
>
But don't use close a file after you've used it? You mean to tell me you
want to actually keep all 10000 files open at all times? That seems a
little extreme, or crazy or something ;)
If you need something like this (which I think would happen very
rarely), you can simply have a cache which opens FILEs on demand. You
just request a read or write with a file name. Internally, if that file
name is open, do read or write. Otherwise, open it and do the same. This
should be a very simple class - no more than 100 lines of code.
Best,
John
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk