gets, gets_s
Aus cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <stdio.h> | ||
char*gets(char*str ); | ||
char*gets_s(char*str, rsize_t n); | (Seit C11)(optional) | |
1)
Liest stdin in die Felder, auf die
str
bis ein Zeilenumbruch gefunden wird oder End-of-Datei auftritt. AOriginal:
Reads stdin into the character array pointed to by
str
until a newline character is found or end-of-file occurs. AThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Nullzeichen unmittelbar nach dem letzten Zeichen in das Array zu lesen geschrieben .
Original:
null character is written immediately after the last character read into the array.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Liest höchstens n-1 Zeichen aus stdin in das Array, auf das
str
bis new-line Zeichen, End-of-File-Bedingung oder Lesefehler. Ein NULL-Zeichen wird sofort nach dem letzten Zeichen in das Array zu lesen geschrieben, oder str[0], wenn keine Zeichen gelesen wurden .Original:
Reads at most n-1 characters from stdin into the array pointed to by
str
until new-line character, end-of-file condition, or read error. A null character is written immediately after the last character read into the array, or to str[0] if no characters were read.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
@ @ If
n
Null oder größer ist als RSIZE_MAX, ein Null-Zeichen wird str[0] geschrieben, aber die Funktion liest und verwirft Zeichen aus stdin bis new-line Zeichen, End-of-File-Bedingung, oder lesen Sie Fehler .Original:
@@ If
n
is zero or is greater than RSIZE_MAX, a null character is written to str[0] but the function reads and discards characters from stdin until new-line character, end-of-file condition, or read error.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
@ @ If
n-1
Zeichen gelesen wurden, liest weiter und verwirft die Zeichen aus stdin bis new-line Zeichen, End-of-File-Bedingung, oder lesen Sie Fehler .Original:
@@ If
n-1
characters have been read, continues reading and discarding the characters from stdin until new-line character, end-of-file condition, or read error.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
@ @ Die
gets_s
Funktion ist eine Erweiterung und ist optional. Es wird garantiert, dass nur vorhanden, wenn __STDC_LIB_EXT1__ definiert ist .Original:
@@ The
gets_s
function is an extension and is optional. It is guaranteed to be present only if __STDC_LIB_EXT1__ is defined.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Parameter
str | - | Zeichenkette geschrieben werden soll Original: character string to be written The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten]Rückgabewert
str
bei Erfolg NULL andersOriginal:
str
on success, NULL otherwiseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Notes
Die
gets()
Funktion führt keine Überprüfung der Grenzen, ist daher diese Funktion extrem anfällig für Buffer-Overflow-Attacken. Es kann nicht sicher verwendet werden (es sei denn, das Programm läuft in einem Umfeld, das, was man auf stdin
erscheinen beschränkt). Aus diesem Grund wurde die Funktion in der dritten Berichtigung wurde der C99-Standard veraltet und ganz in der C11-Standard entfernt. fgets()
und gets_s()
sind die empfohlenen Ersatz .Original:
The
gets()
function does not perform bounds checking, therefore this function is extremely vulnerable to buffer-overflow attacks. It cannot be used safely (unless the program runs in an environment which restricts what can appear on stdin
). For this reason, the function has been deprecated in the third corrigendum to the C99 standard and removed altogether in the C11 standard. fgets()
and gets_s()
are the recommended replacements.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Verwenden Sie niemals
gets()
.Original:
Never use
gets()
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Siehe auch
liest formatierten Eingaben von stdin, eine Datei-Strom oder einen Puffer Original: reads formatted input from stdin, a file stream or a buffer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
erhält eine Zeichenkette aus einem Datei-Stream Original: gets a character string from a file stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
schreibt eine Zeichenkette in einer Datei-Stream Original: writes a character string to a file stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
C++ documentation for gets |