The u8sscanf_s function reads a formatted utf-8 string, and writes to a list of arguments.
UTF-8 is byte-compatible with the underlying scanner, so this is otherwise identical to sscanf_s(), except that – unlike the rest of the scanf_s family – the c, s, and %[ conversion specifiers here require their Annex K companion rsize_t destination- size argument: u8sscanf_s() always consumes and enforces it, since it has the whole source buffer available up front to do so safely (unlike the streaming scanf_s variants, where that two-argument convention is documented but not yet enforced).
- Parameters
-
| [in] | buffer | pointer to a NUL-terminated utf-8 string to read from |
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to; every c, s, and %[ is followed by an rsize_t giving the size of its destination array |
- Precondition
- Neither
buffer nor fmt shall be a null pointer.
-
buffer shall not contain an illegal or truncated UTF-8 sequence.
-
c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character).
- Returns
- Number of receiving arguments successfully assigned, or
EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.
- Return values
-
| > | 0 on success, the number of arguments assigned |
| EOF | on error, or when buffer contains illegal UTF-8 or a c/s/%[ destination is too small (errno set to EILSEQ resp. ESNOSPC) |
- See also
- vu8sscanf_s(), sscanf_s()