Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列「abc 123 456」を文字列 (「abc」) と 2 つの数字 (123,456) に分割したいと考えています。以下のコードにはどのような形式を入力すればよいですか?
char *s; int a,b; sscanf("acb 123 456", format, s, &a, &b);
あなたがしたい:
"%s%d%d"
ただし、抽出する文字列にバッファ スペースを割り当てる必要もあります。
char s[100]; int a,b; sscanf("acb 123 456", "%s%d%d", s, &a, &b);