Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!apple!agate!shelby!csli!dmr From: dmr@csli.Stanford.EDU (Daniel M. Rosenberg) Newsgroups: comp.sys.mac.programmer Subject: Re: Help with FSRead Keywords: loading data files with FSRead Message-ID: <15457@csli.Stanford.EDU> Date: 21 Sep 90 16:58:59 GMT References: <13963@hydra.gatech.EDU> Sender: dmr@csli.Stanford.EDU (Daniel M. Rosenberg) Organization: World Otherness Ministries Lines: 28 In <13963@hydra.gatech.EDU> gt4586c@prism.gatech.EDU (WILLETT,THOMAS CARTER) writes: >I would like to solicit some assistance in the use of FSRead. >... My question is: how do i know how much memory to allocate >to the buffer into which the data is placed, and how do i get to the numbers >which are lurking in the buffer, i.e. how do i go to the buffer and ask it >to give me integers or reals or whatever so i can put them into an array? >I would greatly appreciate any assistance. Thanks. FSRead looks like this: FUNCTION FSRead(refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr); How much memory do you allocate? Enough so that you can read count bytes of data into it. For example, if you want to read your file in 200 byte chunks, your buffPtr should point to an area of memory 200 bytes long. How do you get to the numbers lurking in the buffer? Well, golly, I do this in C and not Pascal, but you need to write or find functions out there that convert from 8 bit integers (or shorts or chars -- chars being the likeliest way Pascal sees them) to reals. Check your Pascal library functions. Good luck. -- # Daniel M. Rosenberg // Stanford CSLI // Chew my opinions, not Stanford's. # dmr@csli.stanford.edu // decwrl!csli!dmr // dmr%csli@stanford.bitnet