Article View: comp.sys.atari.st
Article #29178Re: FILE I/O
From: Preston Bannister
Date: Wed, 11 Nov 1987 15:45
Date: Wed, 11 Nov 1987 15:45
34 lines
1628 bytes
1628 bytes
In article <183@decvax.UUCP> minow@decvax.UUCP (Martin Minow) writes:
>In article <2023@homxc.UUCP> jdn@homxc.UUCP (J.NAGY) asks about the
>difference between Fseek and fseek (etc.), noting that they look
>quite similar.
>
>The Upper-case functions ... are *much* harder to use.
[ text of example deleted ]
There is a much simpler way to find the length of a file. You simply
do an Fseek to the end of the file. This means of getting the length
of a file is also usable with Unix and MSDOS (if not always necessary).
(I'm doing this from memory):
void
Example (filename)
char *filename;
{
int f, length;
f = Fopen(name,0);
if (f > 0)
{
length = Fseek(f,0,2); /* seek to end of file */
Fseek(f,0,0); /* seek back to beginning of file */
/* we now know the size of the file */
ProcessFile(f,length); /* for instance */
Fclose(f);
}
}
--
Preston L. Bannister
USENET : ucbvax!trwrb!felix!preston
BIX : plb
CompuServe : 71350,3505
GEnie : p.bannister
Technical Details
Message-ID:
<12361@felix.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!ccicpg!felix!prestonReferences:
<2023@homxc.UUCP> <183@decvax.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!ccicpg!felix!preston From: preston@felix.UUCP (Preston Bannister) Newsgroups: comp.sys.atari.st Subject: Re: FILE I/O Message-ID: <12361@felix.UUCP> Date: Wed, 11-Nov-87 10:45:13 EST Article-I.D.: felix.12361 Posted: Wed Nov 11 10:45:13 1987 Date-Received: Sat, 14-Nov-87 18:48:02 EST References: <2023@homxc.UUCP> <183@decvax.UUCP> Sender: daemon@felix.UUCP Reply-To: preston@felix.UUCP (Preston Bannister) Organization: FileNet Corp., Costa Mesa, CA Lines: 34 Keywords: Mark Williams C, Fseek, fseek