Article View: borland.public.cppbuilder.nativeapi
Article #5586Re: Amount of open files
From: Andreas Osswald
Date: Wed, 03 Aug 2005 12:31
Date: Wed, 03 Aug 2005 12:31
40 lines
2690 bytes
2690 bytes
I want to know how many files are opened by my application without closing it. You are right if you say the programm should know this. But if you forgot once to use close() or you returned out of a function before you call close() a stream keeps open. Under DOS-OS there was the possibility to use flushall() it returned all open streams an it was helpful to find errors like described. Andreas "Andrue Cope [TeamB]" <no.spam@not.a.valid.address> schrieb im Newsbeitrag news:42f095b9$1@newsgroups.borland.com... > Andreas Osswald wrote: > > > Hallo, is there any way to get the total amount of open files, opened > > by the own application ? > > What do you mean exactly? > > If you want to know how many open files your application has at any one > time then I'd have to question your overall design and implementation. > IMO there should be no reason for you not to know that. A program that > doesn't know what state it's in sounds very dubious to me. > > If you want to know how many files your application has opened in total > (ie;how many times has open() been called) then I can think of no > standard way to do that. The easiest way would be to have all file I/O > open requests go through your own routine that can keep a count. This > can only be enforced through programming convention but it's not a bad > idea. > > We always use our own home grown functions (classes in more recent > code) because for us having that kind of centralised control over file > I/O offers many advantages. Logging all I/O is not something we bother > with at the moment but it would certainly be one application. > > -- > Andrue Cope [TeamB] > [Bicester, Uk] > http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<42f0b912$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42f09312$1@newsgroups.borland.com> <42f095b9$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6a0cee41cdcb7499 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Andreas Osswald" <noname@noname.de> Newsgroups: borland.public.cppbuilder.nativeapi References: <42f09312$1@newsgroups.borland.com> <42f095b9$1@newsgroups.borland.com> Subject: Re: Amount of open files Date: Wed, 3 Aug 2005 14:31:02 +0200 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 84.156.179.93 Message-ID: <42f0b912$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1123072274 84.156.179.93 (3 Aug 2005 05:31:14 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail