sandell@ils.nwu.edu (Greg Sandell) (08/11/90)
Using FSRead() I find that I can read only a limited number of bytes at a time. In the code below byteCount can be as large as 1500 but when I use a value of 2000 the program dies a strange death: the disk light stays continuously lit (non-blinking) and the disk whirs forever until I reboot. byteCount = 1000L; FSRead(fRefNum, &byteCount, (char *)data); Has anybody run into this problem? Has it been documented? There is no mention of the limit in Mac Revealed or Inside Mac. Thanks in advance, Greg Sandell **************************************************************** * Greg Sandell (sandell@ils.nwu.edu) Evanston, IL * * Institute for the Learning Sciences, Northwestern University * ****************************************************************
philip@pescadero.Stanford.EDU (Philip Machanick) (08/12/90)
In article <1335@anaxagoras.ils.nwu.edu>, sandell@ils.nwu.edu (Greg Sandell) writes: > Using FSRead() I find that I can read only a limited number of > bytes at a time. In the code below byteCount can be as large > as 1500 but when I use a value of 2000 the program dies a strange > death: the disk light stays continuously lit (non-blinking) > and the disk whirs forever until I reboot. > > byteCount = 1000L; > FSRead(fRefNum, &byteCount, (char *)data); > > Has anybody run into this problem? Has it been documented? > There is no mention of the limit in Mac Revealed or Inside Mac. I've used FSREAD for much larger data. How much space did you allocate for "data"? Philip Machanick philip@pescadero.stanford.edu
anderson@Apple.COM (Clark Anderson) (08/12/90)
From: sandell@ils.nwu.edu (Greg Sandell) Subject: FSRead() limit on number of bytes >Using FSRead() I find that I can read only a limited number of >bytes at a time. In the code below byteCount can be as large >as 1500 but when I use a value of 2000 the program dies a strange >death.... I'm not clear on what buffer you're putting the data INTO when you read it. You need to allocate a buffer of some kind (array, record (struct), or something), and it needs to be large enough to hold the data. The last parameter of FSRead is a pointer (or address) of the beginning of the buffer you want the data to go into. I've used FSRead for larger block of data than 2000 bytes with no problem. You might check the byteCount parameter right after you do the read. It will contain the actual number of bytes that were read. Hope that helps... --clark -- ----------------------------------------------------------- Clark Anderson InterNet: anderson@apple.com PCB Software Tools AppleLink: C.ANDERSON Apple Computer, Inc BellNet: 408-974-4593 "I speak only for myself, much to my employer's relief..." -----------------------------------------------------------
topping@iroquois.cis.ohio-state.edu (brian e topping) (08/13/90)
In article <1335@anaxagoras.ils.nwu.edu> sandell@ils.nwu.edu (Greg Sandell) writes: >Using FSRead() I find that I can read only a limited number of >.... deleted.... >byteCount = 1000L; >FSRead(fRefNum, &byteCount, (char *)data); You might check with MacsBug what is _actually_ being passed in the data parameter. If data is a struct, it is going to copy the thing onto the stack and the toolbox is going to use the first long in the struct as a pointer to the data. If this is true you want to change the last param to (char *)&data instead of just (char *)data. Brian Topping <topping@cis.ohio-state.edu>
russotto@eng.umd.edu (Matthew T. Russotto) (08/13/90)
In article <1335@anaxagoras.ils.nwu.edu> sandell@ils.nwu.edu (Greg Sandell) writes: >Using FSRead() I find that I can read only a limited number of >bytes at a time. In the code below byteCount can be as large >as 1500 but when I use a value of 2000 the program dies a strange >death: the disk light stays continuously lit (non-blinking) >and the disk whirs forever until I reboot. > >byteCount = 1000L; >FSRead(fRefNum, &byteCount, (char *)data); > I do disk reads of well over 1000 bytes routinely (in fact, they are often 0x1000 bytes). Are you sure the 'data' buffer is big enough? -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?
stevec@Apple.COM (Steve Christensen) (08/13/90)
In article <1335@anaxagoras.ils.nwu.edu> sandell@ils.nwu.edu (Greg Sandell) writes: >Using FSRead() I find that I can read only a limited number of >bytes at a time. In the code below byteCount can be as large >as 1500 but when I use a value of 2000 the program dies a strange >death: the disk light stays continuously lit (non-blinking) >and the disk whirs forever until I reboot. > >byteCount = 1000L; >FSRead(fRefNum, &byteCount, (char *)data); > >Has anybody run into this problem? Has it been documented? >There is no mention of the limit in Mac Revealed or Inside Mac. I have been known to read a meg or more out of a file in one shot. Have you checked to make sure your buffer can hold that many bytes? Just a guess... steve -- ____________________________________________________________________ Steve Christensen Internet: stevec@goofy.apple.com Apple Computer, Inc. AppleLink: STEVEC 20525 Mariani Ave, MS 81-CS CompuServe: 76174,1712 Cupertino, CA 95014 "You just contradicted me." "No I didn't." ____________________________________________________________________