[benh@kernel.crashing.org: Bug#180490: PPC: Please build with -fsigned-char or fix usage of char vs. int with getc()]
Francis J. A. Pinteric
linuxdoctor@linux.ca
Tue Feb 18 14:54:01 2003
--=.Q_hZG3l2igZt(B
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
On Mon, 10 Feb 2003 20:35:53 +0100
Bastian Blank <waldi@debian.org> wrote:
> char is unsigned on PPC
>
> char c = getc(file);
> while(c != EOF)
> blah();
>
> The above doesn't work.
>
Unless you've got a non-standard C-library, getc() returns an int and
therefore the declaration should be `int c' and not `char c'. Here's the
top part of the man page:
NAME
fgetc, fgets, getc, getchar, gets, ungetc - input of char-
acters and strings
SYNOPSIS
#include <stdio.h>
int fgetc(FILE *stream);
char *fgets(char *s, int size, FILE *stream);
int getc(FILE *stream);
int getchar(void);
char *gets(char *s);
int ungetc(int c, FILE *stream)
>>>--fja->
--=.Q_hZG3l2igZt(B
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+Ujs8ZXoXOVknTgARArRpAJ4jHDj+/bv0r0cozS2D+Mr+R4slAACeOtNJ
w3v+rClTg1fduA6M15mbQ64=
=Dq9D
-----END PGP SIGNATURE-----
--=.Q_hZG3l2igZt(B--