www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/18/03:24:12

From: lsantil AT calstatela DOT edu
Date: Wed, 17 Jun 1998 21:58:21 -0700 (PDT)
Message-Id: <199806180458.VAA09502@neptune.calstatela.edu>
To: djgpp AT delorie DOT com
Subject: Get file size in C++

How is it possible to get the size of a file in C++?  I know if I opened
a file in C w/ "FILE *f;" that I just include "io.h" & use printf to print its
size from the return val of "filelength(fileno(f))" but I'm using ifstream &
"fstream.h" to open my files.  I looked thru the "lang/cxx/" dir & found
"iostdio.h" which makes some of the "stdio.h" defines equivalent to _IO_*
including "#define fileno _IO_fileno" //line 107// but I dont see how I can
do the same with "ifstream f".  any suggestions?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019