Sounds like you just want to ignore whitespace, so add spaces to your format where it might occur:
scanf(" { [%lf ;%lf ] , [%lf ;%lf ] , [%lf ;%lf ] }", ...)
The only place you don't need it is immediately before %lf
as that specifier automatically skips and ignores whitespace. Be sure to check the return value to ensure you matched 6 values. Unfortunately this will not tell you if the trailing ]
or }
is missing. For that you can add an extra %n
specifier at the end and check to make sure it gets set:
int end = 0;
if (scanf(" { [%lf ;%lf ] , [%lf ;%lf ] , [%lf ;%lf ] }%n", ..., &end), end > 0) {
// successful read
} else {
// error
}