Newsgroups: comp.sys.mac.programmer Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!ox.com!oxtrap!oxtrap!time From: time@oxtrap.aa.ox.com (Tim Endres) Subject: Re: How read by line from file? In-Reply-To: yahnke@vms.macc.wisc.edu's message of 6 Feb 90 15:38:02 GMT Message-ID: Sender: time@oxtrap.aa.ox.com (Tim Endres) Reply-To: time@oxtrap.UUCP Organization: Oxtrap - Ann Arbor, MI References: <3129@dogie.macc.wisc.edu> Date: 6 Feb 90 16:12:19 In article <3129@dogie.macc.wisc.edu> yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) writes: In article , rf1m+@andrew.cmu.edu (Richard Vernon Ford) writes... -How do you use FSRead in newline mode? It seems as if it should be -simple to read from a file, one line at a time. Could someone please -send me an example, (I'm using Think C 4.0). You ask how you use FSRead in newline mode? Hah! FSRead has no newline mode, bunky. You bite the bullet and buffer your i/o. Allocate a chunk 'o mem, FSRead into that, and move a ptr thru the chunk searching for carriage returns. When your ptr gets near the end of the chunk 'o mem, do another FSRead. I glossed over a few details, but you get the picture. I believe this is wrong. When I wrote the MacNFS client, we had serious problems debugging BinHex which used the NewLine mode of the Mac File System. I believe you specify in the high byte of a parameter to the open call or the read call the character to end reading on. In your case this character is newline. Please EMail me if you can not find the documentation, which should be in VolII. BUT, I am almost certain this can be done!