On Tue, Nov 14, 2023 at 10:21:27AM +0100, Alejandro Colomar wrote: > mbstowcs(3) has the following: > > In order to avoid the case 2 above, the programmer should make > sure n is greater than or equal to mbstowcs(NULL,src,0)+1. > > We could add that. That might have enlightened me! I like the wording, and indeed, having it phrased the same way for these similar functions would be helpful. > BTW, maybe you want to use mbstowcs(3), which is simpler. Indeed I should have chosen that. > I think we could add something saying that mbsrtowcs(3) is a > restartable version of mbstowcs(3). It might have helped me, and probably will help others. Thanks Alejandro!