spacer
написал 27 июля 2005 года в 15:56 (1061 просмотр)
Ведет себя
как мужчина; открыл 11 тем в форуме, оставил 36 комментариев на сайте.
Вичитал вот что возможно такое:
scanf("%[^\n]\n", s);
%[^\n] - читать любые символы, кроме \n (до \n)
\n - пропустить \n на конце строки
%[abcdef] - читать слово,
состоящее из перечисленных букв.
%[^abcde] - читать слово из любых букв,
кроме перечисленных (прерваться по букве из списка).
В манах подробностей не нашел. Мож ткете где по подробнее почитать?
Последние комментарии
-
OlegL, 17 декабря 2023 года в 15:00 →
Перекличка
21
-
REDkiy, 8 июня 2023 года в 9:09 →
Как «замокать» файл для юниттеста в Python?
2
-
fhunter, 29 ноября 2022 года в 2:09 →
Проблема с NO_PUBKEY: как получить GPG-ключ и добавить его в базу apt?
6
-
Иванн, 9 апреля 2022 года в 8:31 →
Ассоциация РАСПО провела первое учредительное собрание
1
-
Kiri11.ADV1, 7 марта 2021 года в 12:01 →
Логи catalina.out в TomCat 9 в формате JSON
1
DevOps as a Service from Palark
24/7 SRE & DevOps service to cover all your Kubernetes needs.

Quote from «man scanf»
[ Matches a nonempty sequence of characters from the specified set of accepted characters; the next pointer must be a pointer to char, and there must be enough room for all the characters in the string, plus a terminating NUL character. The usual skip of leading white space is suppressed. The string is to be made up of characters in (or not in) a particular set; the set is defined by the characters between the open bracket [ character and a close bracket ] charac- ter. The set excludes those characters if the first character after the open bracket is a circumflex ^. To include a close bracket in the set, make it the first character after the open bracket or the circumflex; any other position will end the set. The hyphen character - is also special; when placed between two other characters, it adds all intervening characters to the set. To include a hyphen, make it the last character before the final close bracket. For instance, `[^]0-9-]' means the set ``everything except close bracket, zero through nine, and hyphen''. The string ends with the appearance of a character not in the (or, with a cir- cumflex, in) set or when the field width runs out. If an l qualifier is present, the next pointer must be a pointer to wchar_t, into which the input will be placed after conversion by mbrtowc(3).я все эти штучки, выяснял в info libc