User Tools

Site Tools


c:conio.h:cgets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:conio.h:cgets [2013/02/03 21:04]
127.0.0.1 external edit
c:conio.h:cgets [2024/02/16 01:05] (current)
Line 1: Line 1:
 ====== cgets ====== ====== cgets ======
 <code c> <code c>
 +char *cgets(char *str);
 </code> </code>
  
 ==== description of cgets ==== ==== description of cgets ====
-cgets is in work by code-reference.com \\  +Reads a string from the console.\\ 
-if you are faster... don't hasitate and add it+\\ 
 +cgets reads a string of characters from the console and stores the string (and the string length) in the location pointed to by str.\\ 
 +\\ 
 +cgets reads as long as a sign to mark the combination carriage return / line feed (CR / LF) occurs or the maximum number of characters has been readWhen reading cgets the CR / LF combination is replaced by the combination of characters \ 0 (null terminator) before the string is stored.\\ 
 +\\ 
 +Assign str[0] before calling cgets to the maximum length of the string to be read.\\ After completion of the read operation st is assigned[1] the actual number of characters read.\\ The reading begins with the character at position str[2] and ends with the null terminator.\\ Consequently, at least str str[0] in length plus 2 bytes.\\
  
 +return value: a pointer to str[2]\\
 <code c> <code c>
-no example at the moment+#include <stdio.h> 
 +#include <conio.h> 
 +int main(void) 
 +
 +   char buffer[83]; 
 +   char    *p; 
 +   buffer[0] = 81; 
 +   printf("Input some chars:"); 
 +   p = cgets(buffer); 
 +   printf("\ncgets read %d characters: \"%s\"\n", buffer[1], p); 
 +   return 0; 
 +}
 </code> </code>
  
 ===== output of cgets c example ===== ===== output of cgets c example =====
-    no example at the moment+    Input some chars: 123 
 +    cgets read 3 characters
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/conio.h/cgets.1359921845.txt · Last modified: 2024/02/16 01:03 (external edit)

Impressum Datenschutz