From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: filelength(): POSIX or not Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: <753uvso5d74rfdhndnrc98aoksgl0i7hvp@4ax.com> References: <972911905 DOT 508266 AT shelley DOT paradise DOT net DOT nz> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 24 X-Trace: /K0ZEE7Aqmx4Gv+uAgeiyCeYQ/DFsAPUVZZt5pjAzO5EQw5ZP8D+8aklF3WhG3zmUKb+SEXzbRJQ!NrgH64tz8H4YWqPeIE25AJpbsqDvaKBwRtQMCvmeGafD540+/1TueEGGqUSTkLiBTVY/Wv8mKIzT!/9W5QA== X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Tue, 31 Oct 2000 18:18:05 GMT Distribution: world Date: Tue, 31 Oct 2000 18:18:05 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 31 Oct 2000 02:19:45 +1300, "Edmund Horner" wrote: >While looking for a substitute "filelength()" for use under Linux, I came >upon the source for the DJGPP filelength(): > >src/libc/posix/sys/stat/filelen.c > >Does this mean that filelength() _is_ a POSIX function? According to its >info page, it's "not POSIX". here's your substitute: fopen() the file in "rb" mode, fseek() to the end, and read the length with ftell(). This is ANSI so it should work on any full ANSI C compiler. --