Path: utzoo!attcan!uunet!mcsun!ukc!edcastle!lfcs!nick From: nick@lfcs.ed.ac.uk (Nick Rothwell) Newsgroups: comp.sys.mac.programmer Subject: Re: Carriage Returns in ascii files Message-ID: <5434@castle.ed.ac.uk> Date: 31 Jul 90 11:53:23 GMT References: <14711@csli.Stanford.EDU> Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell) Organization: Wavetables 'R' Us Lines: 27 In-reply-to: francis@csli.Stanford.EDU (Dave Francis) In article <14711@csli.Stanford.EDU>, francis@csli (Dave Francis) writes: >len = 1L; >err = FSWrite(refNum, &len, "\n"); > >But instead I get unrecognizable characters (those rectangles) >instead of carriage returns when I look at the file with TeachText. >How do I get a real carriage return appended? Using "\r" should do it. My understanding (I'm open to correction) is that the ANSI I/O library stuff in THINK C does \r -> \n conversion on the way in, and \n -> \r conversion on the way out, so standard C programs can deal with Mac TEXT files while having lines appear to be \n-delimited. FSWrite is a toolbox call, and so it's in Mac-land, with explicit \r's everywhere. This whole business really is a pain, especially if you want to start doing things with binary files passed between different hosts. Nick. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcsun!ukc!lfcs!nick ~ ~~ ~~ ~~ ~~ Hey, son, get that DeLorean off the track! And ~~ ~~ ~~ ~~ ~ what have you done with all my lovely harpsichords?