Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip an item #55

Closed
AlfredXiaSF opened this issue Mar 10, 2022 · 1 comment
Closed

Skip an item #55

AlfredXiaSF opened this issue Mar 10, 2022 · 1 comment

Comments

@AlfredXiaSF
Copy link

Is there a way to skip an item when use scnlib? I mean in scanf we can use * to skipt an item:

int count;
scanf("%d%*c", &count);

*c means, that a char will be read but won't be assigned, for example for the input "30a" it will assign 30 to count, but 'a' will be ignored.
Is there a similay way in scnlib to implement this?

@eliaskosunen
Copy link
Owner

scn::discard provides this functionality:

int count;
auto ret = scn::input("{}{}", count, scn::discard<char>());

There's no way to achieve this using the format string.

@eliaskosunen eliaskosunen closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants