home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14175 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  2.0 KB

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!mips!darwin.sura.net!mojo.eng.umd.edu!russotto
  2. From: russotto@eng.umd.edu (Matthew T. Russotto)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Newline mode
  5. Message-ID: <1992Aug18.220053.14547@eng.umd.edu>
  6. Date: 18 Aug 92 22:00:53 GMT
  7. References: <ISBELL.92Aug18131432@pop-tarts.ai.mit.edu>
  8. Organization: College of Engineering, University of Maryland, College Park
  9. Lines: 29
  10.  
  11. In article <ISBELL.92Aug18131432@pop-tarts.ai.mit.edu> isbell@ai.mit.edu (Charles L Isbell) writes:
  12. >
  13. >Here's an easy one.  Think C.  Mac file manager interface (ie FSRead()
  14. >as opposed to fgets(), etc).  I want to read in a line (defined as a
  15. >string of characters terminated by a newline) at a time.  Inside Mac
  16. >say there's a newline mode that will do this for you automatically,
  17. >but doesn't explain how to do it.  Currently I read in a character at
  18. >a time until I hit a newline, but I'm sure that's just toooooo slow.
  19. >
  20. >So, how do I do this nwline thing (ie implement a fast fgets())?
  21.  
  22. Believe it or not, newline mode is documented!  OK, not documented
  23. anywhere near its first mention, but it is documented :-)
  24.  
  25. From the electronic Inside Mac:
  26. Note:  Advanced programmers:Bit 7 of ioPosMode is the newline flag; it's
  27.        set if read operations should terminate at a newline character. The
  28.        ASCII code of the newline character is specified in the high-order
  29.        byte of ioPosMode. If the newline flag is set, the data will be read
  30.        one byte at a time until the newline character is encountered,
  31.        ioReqCount bytes have been read, or the end-of-file is reached. If
  32.        the newline flag is clear, the data will be read one byte at a time
  33.        until ioReqCount bytes have been read or the end-of-file is reached.
  34.  
  35. -- 
  36. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  37. Some news readers expect "Disclaimer:" here.
  38. Just say NO to police searches and seizures.  Make them use force.
  39. (not responsible for bodily harm resulting from following above advice)
  40.