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 <conio.h>
    char *cgets( char *buf );

Description:
    The cgets function gets a string of characters directly from the console
    and stores the string and its length in the array pointed to by buf.
     The first element of the array buf[0] must contain the maximum length
    in characters of the string to be read.  The array must be big enough to
    hold the string, a terminating null character, and two additional bytes.

    The cgets function reads characters until a carriage-return line-feed
    combination is read, or until the specified number of characters is
    read.  The string is stored in the array starting at buf[2].  The
    carriage-return line-feed combination, if read, is replaced by a null
    character.  The actual length of the string read is placed in buf[1].

Returns:
    The cgets function returns a pointer to the start of the string which is
    at buf[2].

See Also:
    fgets, getch, getche, gets

Example:
    #include <conio.h>

    void main()
      {
        char buffer[82];

        buffer[0] = 80;
        cgets( buffer );
        cprintf( "%s\r\n", &buffer[2] );
      }

Classification:
    WATCOM

Systems:
    All

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