cgets man page on Xenix

Man page or keyword search:  
man Server   1130 pages
apropos Keyword Search (all sections)
Output format
Xenix logo
[printable version]



     CGETS(DOS)		      XENIX System V		    CGETS(DOS)

     Name
	  cgets - Gets a string.

     Syntax
	  #include <conio.h>

	  char *cgets (str);
	  char * str;

     Description
	  The cgets function reads a string of characters directly
	  from the console and stores the string and its length in the
	  location pointed to by str.  The str must be a pointer to a
	  character array. The first element of the array, str[0],
	  must contain the maximum length (in characters) of the
	  string to be read. The array must have enough elements to
	  hold the string, a terminating null character ('\0'), and
	  two additional bytes.

	  cgets continues to read characters until a carriage
	  return/linefeed combination (CR-LF) is read, or the
	  specified number of characters have been read. The string is
	  stored starting at str[2].  If a CR-LF combination is read,
	  it is replaced with a null chracter ('\0') before being
	  stored. cgets then stores the actual length of the string in
	  the second array element, str[1].

     Return Value
	  cgets returns a pointer to the start of the string, which is
	  at str[2].  There is no error returned.

     See Also
	  getch(DOS), getche(DOS)

     Page 1					      (printed 8/7/87)

     CGETS(DOS)		      XENIX System V		    CGETS(DOS)

     Example
	  #include <conio.h>

	  char buffer[82]; char *result; int numread;
	    .
	    .
	    .  *buffer = 80;  /* maximum number of chracters */
			 /* note that *buffer is equivalent
			 ** to buffer[0]
			 */ /* The following statements input a string
	  from the ** keyboard and find its length.  */

	  result = cgets(buffer); numread = buffer[1];

	  /* Result points to the string, and numread is its ** length
	  (not counting the carriage return, which has ** been
	  replaced by a null chracter).	 */

     Notes
	  This call must be compiled with the -dos flag.

     Page 2					      (printed 8/7/87)

[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Xenix

List of man pages available for Xenix

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net