delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/27/15:03:46

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ifstream (FILENAME, ios::binary). Can't Read!!!
Date: Thu, 24 Jul 1997 20:20:17 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 32
Message-ID: <33D7B901.1B29@cs.com>
References: <01bc96d2$0843f060$29fc82c1 AT damien> <33D5318B DOT 25E AT cornell DOT edu> <01bc9790$4682e700$02f882c1 AT damien> <33D6603B DOT 1D8 AT cornell DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp204.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A. Sinan Unur wrote:
> 
> > > do you ever expect to read a fractional number of bytes from a file?
> >
> > No, I just used it cause I always think of doubles as being able to
> > count to a higher number than ints.
> 
> for reasons that are too mundane to explain and take up bandwidth with,
> that is not a good idea. if you insist, you can do it of course, but you
> will be in for a pretty hectic ride.

If, for some reason, you seriously expect that your program might read
more than 4 billion bytes of data from a file, you can use the long long
integer type.  This is a 64 bit integer; the upper limit of which is
approximately 1.845 x 10^19.  It's gcc-specific, but involves less
overhead than float->int conversions.

BTW, I just wrote a little program to print out the maximum value of a
64 bit integer:

18446744073709551615

Pretty impressive, huh?  When computers can hold that many bytes of
information, I'm giving up.  ;)

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "If 'everybody knows' such-and-such, |
|       aka Fighteer I       | then it ain't so, by at least ten    |
|   mailto:fighteer AT cs DOT com   | thousand to one."                    |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------

- Raw text -


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