Hi, On 2024-01-03 16:13, Krzysztof Żelechowski wrote: > It is not clear whether the format string "%[\0a]" matches the input string > "a" or not. I interpret the documentation as saying that once the selector > "%[ " has been opened, the format interpreter must find a matching "]", > therefore it must not interpret the embedded "\0" as the end of the format > string.
According to the C standard, \0 or the NUL character is the end of string. Therefore the string passed to fscanf is simply "%[", which is invalid. > However, trying to use such a format string causes the compiler to > report the warning "format contains NUL", which suggests that using such a > format string involves undefined behaviour. As explained above, the compiler is right about that. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://aurel32.net