OpenAmiga (220/964)

From:Marc Culler
Date:9 Sep 2000 at 15:44:20
Subject:Re: AMIOPEN: [Q] gets and puts

On Sat, Sep 09, 2000 at 02:55:28PM +0200, John Niclasen wrote:
> Ok, my little test program now looks like this:
>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> char str[256];
>
> gets(str);
> printf(">%s<\n", str);
> fflush(stdout);
>
> return 0;
> }
>
> The output of printf should be the string in between '>' and '<', but I
> only see the "><", nomatter what I type.

Looks like a bug to me. I got the same results. Ther is nothing
special about the < and > characters. However, if I replace

with

it works just fine, except of course that the string has LF at the end.

The fgets call has the advantage that it won't overrun your buffer.
But lib/gets, dangerous as it may be, does indeed seem to be broken.

- Marc
Subscribe/Unsubscribe: open-request@amiga.com
Amiga FAQ: http://www.amiga.com/faq.html