Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    char *gets( char *buf );

Description:
    The gets function gets a string of characters from the file designated
    by  stdin and stores them in the array pointed to by buf until
    end-of-file is encountered or a new-line character is read.  Any
    new-line character is discarded, and a null character is placed
    immediately after the last character read into the array.

    It is recommended that  fgets be used instead of  gets because data
    beyond the array buf will be destroyed if a new-line character is not
    read from the input stream  stdin before the end of the array buf is
    reached.

    A common programming error is to assume the presence of a new-line
    character in every string that is read into the array.  A new-line
    character may not appear as the last character in a file, just before
    end-of-file.

Returns:
    The gets function returns buf if successful.  NULL is returned if
    end-of-file is encountered, or if a read error occurs.  When an error
    has occurred,  errno contains a value indicating the type of error that
    has been detected.

See Also:
    fopen, getc, fgetc, fgets, ungetc

Example:
    #include <stdio.h>

    void main()
      {
        char buffer[80];

        while( gets( buffer ) != NULL )
          puts( buffer );
      }

Classification:
    ANSI

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson