]>
git.saurik.com Git - apple/icu.git/blob - icuSources/io/uscanf.c
2 ******************************************************************************
4 * Copyright (C) 1998-2004, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 12/02/98 stephen Creation.
15 * 03/13/99 stephen Modified for new C API.
16 ******************************************************************************
19 #include "unicode/utypes.h"
21 #if !UCONFIG_NO_FORMATTING
23 #include "unicode/putil.h"
24 #include "unicode/ustdio.h"
25 #include "unicode/ustring.h"
34 U_CAPI
int32_t U_EXPORT2
36 const char *patternSpecification
,
42 va_start(ap
, patternSpecification
);
43 converted
= u_vfscanf(f
, patternSpecification
, ap
);
49 U_CAPI
int32_t U_EXPORT2
51 const UChar
*patternSpecification
,
57 va_start(ap
, patternSpecification
);
58 converted
= u_vfscanf_u(f
, patternSpecification
, ap
);
64 U_CAPI
int32_t U_EXPORT2
/* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
66 const char *patternSpecification
,
71 UChar patBuffer
[UFMT_DEFAULT_BUFFER_SIZE
];
72 int32_t size
= (int32_t)uprv_strlen(patternSpecification
) + 1;
74 /* convert from the default codepage to Unicode */
75 if (size
>= MAX_UCHAR_BUFFER_SIZE(patBuffer
)) {
76 pattern
= (UChar
*)uprv_malloc(size
* sizeof(UChar
));
84 u_charsToUChars(patternSpecification
, pattern
, size
);
87 converted
= u_vfscanf_u(f
, pattern
, ap
);
90 if (pattern
!= patBuffer
) {
97 U_CAPI
int32_t U_EXPORT2
/* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
99 const UChar
*patternSpecification
,
102 return u_scanf_parse(f
, patternSpecification
, ap
);
105 #endif /* #if !UCONFIG_NO_FORMATTING */