Re: Q: Line Counting, K&R sec. 1.5.3 on OS X

From: Mo Geffer (spinonhoney_at_optonline.net)
Date: 05/22/04


Date: Sat, 22 May 2004 02:41:20 GMT

In article <nozrc.1047$c94.729@newsfe4-gui>,
 "Kieran Simkin" <kieran@digital-crocus.com> wrote:

> As mentioned by Barry, this problem is not actually a problem, your terminal
> will echo ^D as the character for control+D. Although this behaviour is
> operating system specific, it's not confined to BSD. You should probably not
> attempt to fix this "problem" as that would require mutilating your termcap
> or some other such nasty hack. Either way, this is off-topic. The best
> solution is to add a "\n" before printing anything after receiving an EOF,
> resulting in the ^D being placed on a line on its own and not interfering
> with your result output. I was actually under the impression UNIX did this
> for you, but it appears I'm just used to other people's code doing it. I've
> learned something by lurking :)
>
> --
>
>
> ~Kieran Simkin
> Digital Crocus
> http://digital-crocus.com/
>
> "Mo Geffer" <spinonhoney@optonline.net> wrote in message
> news:spinonhoney-63EBE3.21071921052004@news.easynews.com...
> > In article <barmar-569017.19373121052004@comcast.dca.giganews.com>,
> > Barry Margolin <barmar@alum.mit.edu> wrote:
> >
> > > In article <spinonhoney-B6276B.18295921052004@news.easynews.com>,
> > > Mo Geffer <spinonhoney@optonline.net> wrote:
> > >
> > > > Greetings:
> > > >
> > > > I have a question about the output of the sample program in section
> > > > 1.5.3 Line Counting of K&R, Second Edition.

<snip>

Okay, I went with Kieran's solution. At least my output makes sense now.

Thanks all!!



Relevant Pages

  • Re: Q: Line Counting, K&R sec. 1.5.3 on OS X
    ... will echo ^D as the character for control+D. ... operating system specific, ... Is there a way to "fix" this? ...
    (comp.lang.c)
  • Re: getline and CR, LF, CR/LF, VS/Linux
    ... >> crlf sequences or into the single lf character. ... the operating system will stop reading even though most of the file is ... This is an ancient problem and you can't blame Windows. ...
    (microsoft.public.vc.stl)
  • Re: How to terminate a text file line in Unicode (in Java)
    ... In this case, technically, I might use any character sequence ... though the text file isn't really a text file if its line terminator is not one of the characters designated for such use in character code standards. ... This is somewhat obscure (since the operating system need not use such a convention) and reflects lack of rigorous standardization of the language. ... I guess both candidates are feasible, with no clear preference, but the context and purpose may make one of them preferable. ...
    (comp.std.internat)
  • Re: Creating an operating system with Linux but without GNU
    ... create an operating system built exclusively out of Free and ... They look around and see there are a number of BSD operating systems ... pre-built ports of applications and servers that most people have come ... way you lose both the zealot political movement and the restrictive license ...
    (Fedora)
  • Re: trying to recursively get the files owners and permissions as well as an md5sum of the data
    ... memory taxing", which are both measurable, but "better" because md5sum is ... The NUL character is the one character that cannot ... xargs -0 tells xargs to split it's ... Here, as the cmd is not provided, xargs calls the "echo" command ...
    (comp.unix.shell)