On Mon, Nov 03, 2003 at 06:03:24PM +0100, Paul Diaconescu wrote:
> The result is 255

Hmm, can you try this one?
/* Compile and run as:
 *    gcc -Wall -o testprog testprog.c
 *    ./testprog >/dev/null
 */

#include <stdio.h>

static void testit(char *p)
{
        unsigned char *p2 = (unsigned char *)p;
        if (putchar(*p2++) == EOF) {
                fprintf(stderr, "Oops, wrong!\n");
        } else {
                fprintf(stderr, "Result OK\n");
        }
}

int main(void)
{
        char foo[2];
        foo[0] = '\255';
        testit(foo);
        return 0;
}

Reply via email to