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 ?
If
u_fgets()works similarly to the standardfgets()it will put a '\0' after the last character read. Then you can get the length by callingstrlen()or its equivalent version for your system.If
u_fgets()works similarly to the standardfgets()it will stop filling characters into the buffersso that '\0' gets into the last cell. This will be thenth character ats[n - 1]. Characters not stored will remain in the input streamf.However, please read the documentation! That is always your first stop.