Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

'gets is unsafe'

Name: Anonymous 2013-01-16 1:18

You're just using it incorrectly, you dumb kid.

#include <stdio.h>

int main(void)
{
    char uranus[2];
    int c;

    while ((c = getchar()) != EOF)
        if (c == '\n') {
            ungetc(c, stdin);
            gets(uranus);
        }
    return 0;
}

Name: Lambda Arthur Calculus 2013-01-16 5:20

AIN'T IN DA STANDARD.

Name: Anonymous 2013-01-16 5:44

Jews are unsafe.

Name: Anonymous 2013-01-16 6:27

uranus is not big enough, may cause buffer owerrun. Try saturn or even jupiter if you have enough space.

Name: Anonymous 2013-01-16 11:02

>>4
That was Reddit quality!

Name: Anonymous 2013-01-16 11:10

What's with the surge in Ahmedic shitposting?

Name: Anonymous 2013-01-16 14:21

>>4
Bullshit.

Name: Anonymous 2013-01-16 15:03

>>4
It's fucking huge. It's defined with a size of one whole character more than it will EVER need.

Name: Anonymous 2013-01-16 15:53

>>8
\n and \0 will get loaded into it, it's just as big as it needs to be.

Name: Anonymous 2013-01-16 19:13

>>9
      gets() reads a line from stdin into the buffer pointed to  by  s  until
      either a terminating newline or EOF, which it replaces with a null byte
      ('\0').

Don't change these.
Name: Email:
Entire Thread Thread List