Article View: borland.public.cppbuilder.nativeapi
Article #12358Re: Tracking the number of open files
From: Remy Lebeau (TeamB)
Date: Fri, 12 Dec 2003 20:44
Date: Fri, 12 Dec 2003 20:44
40 lines
2014 bytes
2014 bytes
"Paul Dowd" <pauldowd@seisqc.freeserve.co.uk> wrote in message
news:3fda0259@newsgroups.borland.com...
> Is there an API call or variable that gives the number of files open?
No.
> I could keep track from within my code but there are hundreds
> of them being opened and closed so that would be extremely tedious.
Why not just wrap the opening and closing in a couple of helper functions
that update a global variable internally? For example:
DWORD dwOpenFiles = 0;
HANDLE OpenFile(const char *FileName)
{
open the file ...
if( file was opened )
++dwOpenFiles;
return the file handle;
}
void CloseFile(HANDLE hFile)
{
close the file ...
if( file was closed )
--dwOpenFiles;
}
> Also, how can I increase the number of files that can be simultaneously
> open?
That depends on how you are opening them to begin with. I assume you are
using fopen(), correct? Why not use the CreateFile() function instead,
particularly since you are posting this question to an API newsgroup.
Gambit
Technical Details
Message-ID:
<3fda27b1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fda0259@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5c04324033f7eb51 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-12 13:09:59 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3fda0259@newsgroups.borland.com> Subject: Re: Tracking the number of open files Date: Fri, 12 Dec 2003 12:44:51 -0800 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.23.78.224 Message-ID: <3fda27b1$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071261617 67.23.78.224 (12 Dec 2003 12:40:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail