Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet! From: munroe@batroc.dmc.com (Dick Munroe) Newsgroups: comp.sys.mac.programmer Subject: Re: r vs n in Think C 4.0 Message-ID: <1196@batroc.dmc.com> Date: 16 Feb 90 05:28:11 GMT Organization: Doyle Munroe Consultants Lines: 39 Mike Engber engber@gumball.ils.nwu.edu writes: I was experimenting in Think C (4.0) and it seems that the stdio routines don`t properly distinguish \n and \r. I was under the impression that on the Mac, lines were separated by returns, \r. But whenever I read I get newlines, \n, instead. Similarly, when I print out \n's, \r`s seem to really get output. Now this may be a feature to help portability across UNIX systems that use newlines as line separators, but I was unable to find this documented in the manuals. What gives? -ME Mike, Congratulations, you ran into a bomb that SHOULD have been in stdio since day 1. The Mac file system can operate in one of two modes one converts \r to \n, the other doesn't. I'm not quite sure why Think came up with this change right now, but they sure did. In any event, I think if you open files in text mode \r gets converted. When you open them in binary mode, they don't. I solved the problem by generating all files that are read exclusively by think in binary mode. When I export the files, i.e., write files that might be read by Word or an editting DA I write the file in text mode. Yechh. Dick Munroe -- Dick Munroe uunet!batroc!munroe (UUCP) Doyle Munroe Consultants munroe@batroc.dmc.com (Domain) 267 Cox Street (508) 568-1618 Hudson, Ma. 01749 (508) 562-1133 (FAX)