[EMAIL PROTECTED] (Karl Berry) writes:

> True enough.  I have to shame-facedly confess that I'm not sure of the
> recommended way to write it.  Introduce a char variable, like the below?
> Use a cast somehow?  Paul?

What you had was the right idea, except it should use unsigned char
instead of char, to be portable to (admittedly weird) systems where
char is signed and there's integer overflow checking so an exception
is raised when storing (say) 255 into a char variable.  So this is a
bit better:

  int c;
  while ((c = getchar ()) != EOF)
    {
      unsigned char u = c;
      write (file_descriptor, &u, 1);
    }


Reply via email to