Jarratt Davis writes:
> /* Note: _file is part of the structure of FILE in stdio.h
> It lists the filenumber associated with the opened file.
> This is needed as fstat wont accept a filestream as its
> first argument (at least not under MSVC5) - it has to be a file
> handle usually seen when using open(), while filestreams are
> usually related to fopen().
> */
> err = fstat(fp->_file, &sb);
I made the same mistake in my implementation of ascii pfiles. FILE.file is
only valid in windows. It's FILE._fileno in linux and other at&t variants,
and I think FILE._file_no under bsd.
As Erwin Andreason pointed out here:
http://post.queensu.ca/cgi-bin/listserv/wa?A2=ind9807&L=circle&P=R19631
err = fstat(fileno(fp), &sb);
This should be portable across all systems. I think I've used it in
win95/98, slackware and redhat linux (roughly a year old), and probably at
least one flavor of bsd.
Sam
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT