eliaskosunen/scnlib

Format specifier to skip a field?

Closed this issue · 3 comments

First of all, thanks for an excellent library!

I'm trying to scan a file with the fields of fixed size and I need to skip some of the fields. Is it possible to reflect it somehow in the format string? Something like

scn::scan("{:f8}{:f8}{unused}{:f8}{:f8}",...);

Of course, I can do it by reading first two numbers, then manually skipping 8 chars and then reading in the last two, but this is a lot of code for such a trivial task. I can also read into a dummy unused variable, but it's kind of ugly and wastes time.

Maybe there is some other solution, which is not obvious from the docs?

Discard is probably what you're looking for.

Discard is probably what you're looking for.

The link is broken.

Updated the link.