Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE int32_t U_EXPORT2 u_vsscanf ( const UChar *  buffer,
const char *  patternSpecification,
va_list  ap 
)

Read formatted data from a Unicode string. This is identical to u_sscanf, except that it will not call va_start and va_end.

Parameters:
buffer The Unicode string from which to read.
patternSpecification A pattern specifying how u_sscanf will interpret the variable arguments received and parse the data.
ap The argument list to use.
Returns:
The number of items successfully converted and assigned, or EOF if an error occurred.
See also:
u_sscanf ICU 3.0

Definition at line 64 of file sscanf.c.

{
    int32_t converted;
    UChar *pattern;
    UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
    int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;

    /* convert from the default codepage to Unicode */
    if (size >= MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
        pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
        if(pattern == 0) {
            return 0;
        }
    }
    else {
        pattern = patBuffer;
    }
    u_charsToUChars(patternSpecification, pattern, size);

    /* do the work */
    converted = u_vsscanf_u(buffer, pattern, ap);

    /* clean up */
    if (pattern != patBuffer) {
        uprv_free(pattern);
    }

    return converted;
}


Generated by  Doxygen 1.6.0   Back to index