From: kagel AT quasar DOT bloomberg DOT com Date: Tue, 18 Feb 1997 16:55:42 -0500 Message-Id: <9702182155.AA02194@quasar.bloomberg.com > To: kapieckiel AT harding DOT edu Cc: djgpp AT delorie DOT com In-Reply-To: (kapieckiel@harding.edu) Subject: Re: File sizes... Reply-To: kagel AT dg1 DOT bloomberg DOT com Errors-To: postmaster AT ns1 Date: Sun, 16 Feb 1997 15:13:18 -0600 (CST) From: "Mr. Fuju" X-Sender: kapieckiel AT taz Mime-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Length: 404 If I use open () to open an existing file, how do I determine the filesize? I am not attaching the file to a stream. Here is my code: ---------------- cut here ------------------- #include #include int file1; // file descriptors long filesize; void main (void) { file1 = open ("test.file", O_RDWR | O_CREAT, 0600); // filesize is set here... close (file1); } Call fstat() if the file is already open and stat() before opening it. Both fill a struct stat buffer (to which you have passed a pointer) with file descriptive information. -- Art S. Kagel, kagel AT quasar DOT bloomberg DOT com A proverb is no proverb to you 'till life has illustrated it. -- John Keats