Gets a string of characters directly from the current screen and stores the string and its length in an array
#include <nwconio.h>
char *cgets (
char *buf);
(IN) Points to the array.
cgets returns a pointer to the start of the string, which is at buf [2].
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].
#include <nwconio.h> #include <stdio.h> main () { char buffer[82]; buffer[0]=80; cgets (buffer ); cprintf ("%s\r\n", &buffer[2] ); }