In ICU4C,
UChar * u_fgets(UChar *s, int32_t n, UFILE *f)
will read one line from f
into buffer s
, which size is n
.
But how can I know this one line's length ?
What will happen if n
is not enough for this one line ?
In ICU4C,
UChar * u_fgets(UChar *s, int32_t n, UFILE *f)
will read one line from f
into buffer s
, which size is n
.
But how can I know this one line's length ?
What will happen if n
is not enough for this one line ?
But how can I know this one line's length ?
If u_fgets()
works similarly to the standard fgets()
it will put a '\0' after the last character read. Then you can get the length by calling strlen()
or its equivalent version for your system.
What will happen if n is not enough for this one line ?
If u_fgets()
works similarly to the standard fgets()
it will stop filling characters into the buffer s
so that '\0' gets into the last cell. This will be the n
th character at s[n - 1]
. Characters not stored will remain in the input stream f
.
However, please read the documentation! That is always your first stop.