名前空間
変種
操作

gets, gets_s

提供: cppreference.com
< c‎ | io

 
 
File input/output
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファイルアクセス
Original:
File access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
直接入力/出力
Original:
Direct input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fread
fwrite
書式なし入力/出力
Original:
Unformatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
書式付き入力/出力
Original:
Formatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファイル位置付け
Original:
File positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ftell
fgetpos
fseek
fsetpos
rewind
エラー処理
Original:
Error handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
clearerr
feof
ferror
perror
ファイルに対する操作
Original:
Operations on files
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remove
rename
tmpfile
tmpnam
 
Defined in header <stdio.h>
char *gets( char *str );
char *gets_s(char *str, rsize_t n);
(C11以来)(オプション)
1)
改行文字が見つからないか、ファイルの終わりが発生するまでstdinが指す文字配列にstrを読み込みます。 A
Original:
Reads stdin into the character array pointed to by str until a newline character is found or end-of-file occurs. A
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ヌル文字の直後に配列に読み込まれた最後の文字の後に書かれています.
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.
2)
改行文字、ファイルの終端に達したか、またはエラーを読むまでn-1が指す配列にstdinから最もstr文字で読み込みます。文字が読み取られなかった場合はヌル文字が配列に読み込まれた最後の文字の直後、またはstr[0]に書かれています.
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.
@nゼロまたはRSIZE_MAXより大きい場合は、ヌル文字がstr[0]に書き込まれますが、関数は改行文字、ファイル終了条件、または読み取りエラーまでstdinから文字を読み取って、破棄されて.
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.
@n-1文字が読み取られた場合は、読取りおよび破棄改行文字、ファイル終了条件、または読み取りエラーが発生するまでstdinから文字続け.
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.
@店頭のgets_s機能が拡張で、オプションです。それは__STDC_LIB_EXT1__が定義されている場合のみ存在することが保証されています.
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.

目次

[編集] パラメータ

str -
書き込まれる文字列
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.

[編集] 値を返します

str成功した場合に、そうでなければNULL
Original:
str on success, NULL otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] ノート

gets()関数は境界チェックを実行しないため、この関数は、バッファ·オーバーフロー攻撃に対して非常に脆弱です。それは、(プログラムがどのstdinにも表示される可能性が制限された環境で実行されなければ)安全に使用することはできません。このため、関数はC99標準に第三正誤表では廃止されており、C11標準に完全に削除。 fgets()gets_s()推奨代替です.
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.
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.

[編集] も参照してください

stdin、ファイルストリームまたはバッファからの書式付き入力を読み取ります
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.

(機能) [edit]
ファイルストリームから文字列を取得します
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.

(機能) [edit]
ファイルストリームに文字列を書き込みます
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.

(機能) [edit]