Home > Electronics Tutorials > C Language Tutorial > stdio.h - Character I/O Functions - gets

C Language Programming Library Reference Guide

stdio.h - Character I/O Functions - gets

Declaration: char *gets(char *str); Reads a line from stdin and stores it into the string pointed to by str. It stops when either the newline character is read or when the end-of-file is reached, whichever comes first. The newline character is not copied to the string. A null character is appended to the end of the string.

On success a pointer to the string is returned. On error a null pointer is returned. If the end-of-file occurs before any characters have been read, the string remains unchanged.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster