フォーマット指定子について

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
個↑個↓

フォーマット指定子について

#1

投稿記事 by 個↑個↓ » 9年前

%[^,]

って何ですか

アバター
みけCAT
記事: 6734
登録日時: 14年前
住所: 千葉県
連絡を取る:

Re: フォーマット指定子について

#2

投稿記事 by みけCAT » 9年前

C言語のscanf系の関数の話なら、「,」を含まない1文字以上の文字列にマッチする変換指定子ですね。

N1570 7.21.6.2 The fscanf functionより引用
[ Matches a nonempty sequence of characters from a set of expected characters
(the scanset). 286)
If no l length modifier is present, the corresponding argument shall be a
pointer to the initial element of a character array large enough to accept the
sequence and a terminating null character, which will be added automatically.

(中略)

The conversion specifier includes all subsequent characters in the format
string, up to and including the matching right bracket (]). The characters
between the brackets (the scanlist) compose the scanset, unless the character
after the left bracket is a circumflex (^), in which case the scanset contains all
characters that do not appear in the scanlist between the circumflex and the
right bracket. If the conversion specifier begins with [] or [^], the right
bracket character is in the scanlist and the next following right bracket
character is the matching right bracket that ends the specification; otherwise
the first following right bracket character is the one that ends the
specification. If a - character is in the scanlist and is not the first, nor the
second where the first character is a ^, nor the last character, the behavior is
implementation-defined.
複雑な問題?マシンの性能を上げてOpenMPで殴ればいい!(死亡フラグ)

閉鎖

“C言語何でも質問掲示板” へ戻る