scanf, fscanf, sscanf
提供: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. |
| Defined in header <stdio.h>
|
||
| int scanf( const char *format, ... ); |
(1) | |
| (2) | ||
| int sscanf( const char *buffer, const char *format, ... ); |
(3) | |
さまざまなソースからデータを読み込み、
formatに従ってそれを解釈して、与えられた場所に結果を格納します.Original:
Reads data from the a variety of sources, interprets it according to
format and stores the results into given locations.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.
1)
stdinからデータを読み取ります
Original:
reads the data from stdin
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)
ファイルストリーム
streamからデータを読み取りますOriginal:
reads the data from file stream
streamThe 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.
3)
NULLで終わる文字列
bufferからデータを読み取りますOriginal:
reads the data from null-terminated character string
bufferThe 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.
目次 |
[編集] パラメータ
| stream | - | から読み込むための入力ファイルストリーム
Original: input file stream to read from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| buffer | - | から読み取るための、nullで終わる文字列へのポインタ
Original: pointer to a null-terminated character string to read from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| format | - | 入力を読み取る方法を指定するNULLで終わる文字列へのポインタ。
フォーマット文字列は、空白文字(フォーマット文字列内の任意の1つの空白文字は入力から利用可能なすべての連続した空白文字を消費します)、
%以外の非空白文字(フォーマット文字列で、それぞれの文字が入力から正確に1つの同一の文字を消費する)で構成されていますと変換仕様。各変換仕様の形式は次のとおりですOriginal: The format string consists of whitespace characters (any single whitespace character in the format string consumes all available consecutive whitespace characters from the input), non-whitespace characters except % (each such character in the format strings consumes exactly one identical character from the input) and conversion specifications. Each conversion specification has the following format:The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions.
次の書式指定子が用意されています
Original: The following format specifiers are available: The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions.
Original: pointer to a null-terminated character string specifying how to read the input.
フォーマット文字列は、空白文字(フォーマット文字列内の任意の1つの空白文字は入力から利用可能なすべての連続した空白文字を消費します)、
%以外の非空白文字(フォーマット文字列で、それぞれの文字が入力から正確に1つの同一の文字を消費する)で構成されていますと変換仕様。各変換仕様の形式は次のとおりですOriginal: The format string consists of whitespace characters (any single whitespace character in the format string consumes all available consecutive whitespace characters from the input), non-whitespace characters except % (each such character in the format strings consumes exactly one identical character from the input) and conversion specifications. Each conversion specification has the following format:The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions.
次の書式指定子が用意されています
Original: The following format specifiers are available: The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions.
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ... | - | 引数を受け取る
Original: receiving arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[編集] 値を返します
第1の受信引数が割り当てられていた前に読んで障害が発生した場合に正常に割り当て引数、またはEOFを受け数.
Original:
Number of receiving arguments successfully assigned, or EOF if read failure occurs before the first receiving argument was assigned.
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.
[編集] 例
| This section is incomplete Reason: no example |
[編集] も参照してください
| (C99) (C99) (C99) |
stdin、ファイルストリームまたは可変引数リストを使用してbuffer から書式付き入力を読み取ります Original: reads formatted input from stdin, a file stream or a buffer using variable argument list The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (機能) |
| ファイルストリームから文字列を取得します 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. (機能) | |
| プリントはstdout、ファイルストリームまたはバッファに出力をフォーマットします Original: prints formatted output to stdout, 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. (機能) | |
| C++ documentation for scanf, fscanf, sscanf
| |