Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!cmcl2!nrl-cmf!umix!utah-gr!spline.utah.edu!thomas From: thomas%spline.utah.edu.uucp@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: comp.sys.mac Subject: Re: LSC fread limitation? Message-ID: <2265@utah-gr.UUCP> Date: Thu, 3-Dec-87 01:41:04 EST Article-I.D.: utah-gr.2265 Posted: Thu Dec 3 01:41:04 1987 Date-Received: Sun, 6-Dec-87 10:23:29 EST References: <214@artsvax.UUCP> Sender: news@utah-gr.UUCP Reply-To: thomas%spline.utah.edu.UUCP@utah-gr.UUCP (Spencer W. Thomas) Organization: University of Utah CS Dept Lines: 25 Keywords: LSC fread In article <214@artsvax.UUCP> mike@artsvax.UUCP (Michael Czeiszperger) writes: >fread(buffer,sizeof(char),300*512,fp); > >... always reads in only 44 blocks ... It always returns the number 44*512... >Does anyone have any idea why? Well, let's look at it. 300*512 = 153600 153600 mod 65536 = 22528 22528 / 512 = 44 Therefore we can conclude that LSC's 16 bit integer arithmetic is truncating your result. In fact, the documentation for fread claims that the count argument is an int, so you really can't do better than 32767 bytes at once (unless you set size_of_ptr to something bigger than one). What happens if you use fread( buffer, 300, 512, fp ); ? =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@cs.utah.edu)