gets [C++ Reference]
Keywords: c,io,gets
Date: 2008-10-14T15:42:01-0700

[[gets]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## gets

Syntax:

        #include <cstdio>
        char *gets( char *str );

The gets() function reads characters from stdin and loads them into str, until a newline or EOF is reached. The newline character is translated into a null termination. The return value of gets() is the read-in string, or NULL if there is an error. Note that gets() does not perform bounds checking, and thus risks overrunning str. For a similar (and safer) function that includes bounds checking, see fgets().

Related Topics: fgetc, fgets, fputs, puts

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •