Date : Mon, 24 Sep 1990 00:20:57 GMT
From : attcan!telly!lethe!druid!darcy@uunet.uu.net (D'Arcy J.M. Cain)
Subject: How "hard" is CR-LF
In article <josef.653915275@peun11> josef@nixpbe.UUCP (Moellers) writes:
>Hi,
>Can somebody tell me how "hard" the CR/LF sequence is built into CP/M?
>I'm asking this as I want to read a text-file line by line and need a
>definite place to terminate the line.
>UNIX uses a single \n, but with a two character sequence, I'm not sure
>if LF is always the last character and the second last character is
>always a CR which I can discard.
>
A quick and dirty method that I have used successfully in both DOS and CP/M
is to simply ignore CRs and use \n as the line terminator. This will work
most of the time. It even ports to Unix unchanged although it is a little
wasteful of the CPU checking for non-existent CRs.
--
D'Arcy J.M. Cain (darcy@druid) |
D'Arcy Cain Consulting | MS-DOS: The Andrew Dice Clay
West Hill, Ontario, Canada | of operating systems.
+ 416 281 6094 |