Re: multibyte length



Jordan Abel <random832@xxxxxxxxx> writes:

On 2006-03-03, Micah Cowan <micah@xxxxxxxxxx> wrote:
Jordan Abel <random832@xxxxxxxxx> writes:

Is there a function to find the length, in wide characters, of a
multibyte string?

<OT>
If you have the POSIX version of mbstowcs, you can pass it a NULL
first argument to get this number.

Given that this came up when i was trying to answer someone's question
in c.u.p, this is relevant, thanks.

</OT>

If you limit yourself to Standard C, I think you have to actually
perform the conversion, and then find out with wcslen().

The reason for this was to be able to perform the conversion into memory
that is from malloc while calling malloc only once. in order to make a
wide copy of argv to pass to a "wmain"

Makes sense to me: snprintf() allows this. It's beyond me why Standard
C neglected to provide such a thing in the first place. I kind of hope
that future versions will add the POSIX behavior, as it's very useful,
and certainly not hard to implement.
.



Relevant Pages

  • Re: bug in visual studio .net 2003 - breakpoints and memcpy
    ... Posix is a standard too with no less (some would say ... > platforms that support the conversion. ... Conversion between code pointers to integers does not exist for the sole ...
    (microsoft.public.win32.programmer.kernel)
  • Re: multibyte length
    ... If you have the POSIX version of mbstowcs, you can pass it a NULL ... The reason for this was to be able to perform the conversion into memory ... that is from malloc while calling malloc only once. ...
    (comp.lang.c)
  • Re: fscanf and input failure after the first conversion
    ... a contradiction between POSIX.1-2008 and the ISO C standard. ... Unlucky timing - the Austin Group discussed the issue in a conference ... glibc seems to follow POSIX on this point). ... conversion, as required by the C Standard. ...
    (comp.std.c)
  • POSIX 1003.1 Frequently Asked Questions
    ... This is the Frequently Asked Questions file for the POSIX 1003.1 ... Where can I download the 1003.1 standard from? ... Although originated to refer to the original IEEE Std 1003.1-1988, ... What about POSIX Certification?* ...
    (comp.unix.questions)
  • POSIX 1003.1 Frequently Asked Questions
    ... This is the Frequently Asked Questions file for the POSIX 1003.1 ... Where can I download the 1003.1 standard from? ... Although originated to refer to the original IEEE Std 1003.1-1988, ... What about POSIX Certification?* ...
    (comp.unix.questions)