/usr/include/unicode
NameSizeModeActions
basictz.h89130644editdlrm
bms.h86640644editdlrm
bmsearch.h73160644editdlrm
brkiter.h230010644editdlrm
bytestream.h85310644editdlrm
calendar.h906590644editdlrm
caniter.h72880644editdlrm
chariter.h241860644editdlrm
choicfmt.h295280644editdlrm
coleitr.h129900644editdlrm
coll.h484680644editdlrm
colldata.h119570644editdlrm
curramt.h36590644editdlrm
currpinf.h70610644editdlrm
currunit.h30570644editdlrm
datefmt.h279460644editdlrm
dbbi.h9660644editdlrm
dcfmtsym.h140400644editdlrm
decimfmt.h886120644editdlrm
docmain.h60030644editdlrm
dtfmtsym.h261450644editdlrm
dtintrv.h37340644editdlrm
dtitvfmt.h397000644editdlrm
dtitvinf.h187040644editdlrm
dtptngen.h173030644editdlrm
dtrule.h87180644editdlrm
errorcode.h43610644editdlrm
fieldpos.h87130644editdlrm
fmtable.h187940644editdlrm
format.h120830644editdlrm
gregocal.h337970644editdlrm
locid.h302410644editdlrm
measfmt.h18970644editdlrm
measunit.h16350644editdlrm
measure.h33210644editdlrm
msgfmt.h394350644editdlrm
normlzr.h303370644editdlrm
numfmt.h339870644editdlrm
numsys.h50040644editdlrm
parseerr.h30440644editdlrm
parsepos.h54680644editdlrm
platform.h99610644editdlrm
plurfmt.h230790644editdlrm
plurrule.h99010644editdlrm
ppalmos.h69920644editdlrm
putil.h66860644editdlrm
pwin32.h86680644editdlrm
rbbi.h269930644editdlrm
rbnf.h456810644editdlrm
rbtz.h156950644editdlrm
regex.h523160644editdlrm
rep.h95590644editdlrm
resbund.h181300644editdlrm
schriter.h62930644editdlrm
search.h223570644editdlrm
simpletz.h461790644editdlrm
smpdtfmt.h483250644editdlrm
sortkey.h111110644editdlrm
std_string.h17690644editdlrm
strenum.h98880644editdlrm
stringpiece.h54840644editdlrm
stsearch.h222870644editdlrm
symtable.h41990644editdlrm
tblcoll.h381990644editdlrm
timezone.h345840644editdlrm
tmunit.h34540644editdlrm
tmutamt.h47870644editdlrm
tmutfmt.h86690644editdlrm
translit.h547800644editdlrm
tzrule.h360570644editdlrm
tztrans.h61010644editdlrm
ubidi.h830920644editdlrm
ubrk.h176880644editdlrm
ucal.h401770644editdlrm
ucasemap.h164200644editdlrm
ucat.h53710644editdlrm
uchar.h1110620644editdlrm
uchriter.h131320644editdlrm
uclean.h118550644editdlrm
ucnv.h831110644editdlrm
ucnvsel.h56300644editdlrm
ucnv_cb.h66350644editdlrm
ucnv_err.h213750644editdlrm
ucol.h488260644editdlrm
ucoleitr.h123560644editdlrm
uconfig.h60350644editdlrm
ucsdet.h124640644editdlrm
ucurr.h115720644editdlrm
udat.h344960644editdlrm
udata.h142650644editdlrm
udatpg.h187150644editdlrm
udeprctd.h22840644editdlrm
udraft.h76000644editdlrm
uenum.h57960644editdlrm
uidna.h159180644editdlrm
uintrnal.h157520644editdlrm
uiter.h232340644editdlrm
uloc.h445480644editdlrm
ulocdata.h97390644editdlrm
umachine.h113600644editdlrm
umisc.h12550644editdlrm
umsg.h260760644editdlrm
unifilt.h37700644editdlrm
unifunct.h39660644editdlrm
unimatch.h60710644editdlrm
unirepl.h32900644editdlrm
uniset.h617710644editdlrm
unistr.h1613210644editdlrm
unorm.h236210644editdlrm
unum.h321450644editdlrm
uobject.h113930644editdlrm
uobslete.h8520644editdlrm
uregex.h439480644editdlrm
urename.h925380644editdlrm
urep.h53940644editdlrm
ures.h363480644editdlrm
uscript.h113600644editdlrm
usearch.h342230644editdlrm
uset.h398680644editdlrm
usetiter.h96060644editdlrm
ushape.h179070644editdlrm
uspoof.h387520644editdlrm
usprep.h77500644editdlrm
ustdio.h353330644editdlrm
ustream.h18910644editdlrm
ustring.h693830644editdlrm
usystem.h19250644editdlrm
utext.h583940644editdlrm
utf.h82730644editdlrm
utf8.h205120644editdlrm
utf16.h187760644editdlrm
utf32.h6530644editdlrm
utf_old.h436460644editdlrm
utmscale.h136890644editdlrm
utrace.h133550644editdlrm
utrans.h231290644editdlrm
utypes.h345130644editdlrm
uversion.h109020644editdlrm
vtzone.h200480644editdlrm
Edit: /usr/include/unicode/ustdio.h (35333B)
/* ****************************************************************************** * * Copyright (C) 1998-2009, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * File ustdio.h * * Modification History: * * Date Name Description * 10/16/98 stephen Creation. * 11/06/98 stephen Modified per code review. * 03/12/99 stephen Modified for new C API. * 07/19/99 stephen Minor doc update. * 02/01/01 george Added sprintf & sscanf with all of its variants ****************************************************************************** */ #ifndef USTDIO_H #define USTDIO_H #include #include #include "unicode/utypes.h" #include "unicode/ucnv.h" #include "unicode/utrans.h" /* TODO The following is a small list as to what is currently wrong/suggestions for ustdio. * Make sure that * in the scanf format specification works for all formats. * Each UFILE takes up at least 2KB. Look into adding setvbuf() for configurable buffers. * This library does buffering. The OS should do this for us already. Check on this, and remove it from this library, if this is the case. Double buffering wastes a lot of time and space. * Test stdin and stdout with the u_f* functions * Testing should be done for reading and writing multi-byte encodings, and make sure that a character that is contained across buffer boundries works even for incomplete characters. * Make sure that the last character is flushed when the file/string is closed. * snprintf should follow the C99 standard for the return value, which is return the number of characters (excluding the trailing '\0') which would have been written to the destination string regardless of available space. This is like pre-flighting. * Everything that uses %s should do what operator>> does for UnicodeString. It should convert one byte at a time, and once a character is converted then check to see if it's whitespace or in the scanset. If it's whitespace or in the scanset, put all the bytes back (do nothing for sprintf/sscanf). * If bad string data is encountered, make sure that the function fails without memory leaks and the unconvertable characters are valid substitution or are escaped characters. * u_fungetc() can't unget a character when it's at the beginning of the internal conversion buffer. For example, read the buffer size # of characters, and then ungetc to get the previous character that was at the end of the last buffer. * u_fflush() and u_fclose should return an int32_t like C99 functions. 0 is returned if the operation was successful and EOF otherwise. * u_fsettransliterator does not support U_READ side of transliteration. * The format specifier should limit the size of a format or honor it in order to prevent buffer overruns. (e.g. %256.256d). * u_fread and u_fwrite don't exist. They're needed for reading and writing data structures without any conversion. * u_file_read and u_file_write are used for writing strings. u_fgets and u_fputs or u_fread and u_fwrite should be used to do this. * The width parameter for all scanf formats, including scanset, needs better testing. This prevents buffer overflows. * Figure out what is suppose to happen when a codepage is changed midstream. Maybe a flush or a rewind are good enough. * Make sure that a UFile opened with "rw" can be used after using u_fflush with a u_frewind. * scanf(%i) should detect what type of number to use. * Add more testing of the alternate format, %# * Look at newline handling of fputs/puts * Think more about codeunit/codepoint error handling/support in %S,%s,%C,%c,%[] * Complete the file documentation with proper doxygen formatting. See http://oss.software.ibm.com/pipermail/icu/2003-July/005647.html */ /** * \file * \brief C API: Unicode stdio-like API * *

Unicode stdio-like C API

* *

This API provides an stdio-like API wrapper around ICU's other * formatting and parsing APIs. It is meant to ease the transition of adding * Unicode support to a preexisting applications using stdio. The following * is a small list of noticable differences between stdio and ICU I/O's * ustdio implementation.

* *
    *
  • Locale specific formatting and parsing is only done with file IO.
  • *
  • u_fstropen can be used to simulate file IO with strings. * This is similar to the iostream API, and it allows locale specific * formatting and parsing to be used.
  • *
  • This API provides uniform formatting and parsing behavior between * platforms (unlike the standard stdio implementations found on various * platforms).
  • *
  • This API is better suited for text data handling than binary data * handling when compared to the typical stdio implementation.
  • *
  • You can specify a Transliterator while using the file IO.
  • *
  • You can specify a file's codepage separately from the default * system codepage.
  • *
* *

Formatting and Parsing Specification

* * General printf format:
* %[format modifier][width][.precision][type modifier][format] * * General scanf format:
* %[*][format modifier][width][type modifier][format] *
formatdefault
printf
type
default
scanf
type
description
%EdoublefloatScientific with an uppercase exponent
%edoublefloatScientific with a lowercase exponent
%GdoublefloatUse %E or %f for best format
%gdoublefloatUse %e or %f for best format
%fdoublefloatSimple floating point without the exponent
%Xint32_tint32_tustdio special uppercase hex radix formatting
%xint32_tint32_tustdio special lowercase hex radix formatting
%dint32_tint32_tDecimal format
%iint32_tint32_tSame as %d
%nint32_tint32_tcount (write the number of UTF-16 codeunits read/written)
%oint32_tint32_tustdio special octal radix formatting
%uuint32_tuint32_tDecimal format
%pvoid *void *Prints the pointer value
%schar *char *Use default converter or specified converter from fopen
%ccharcharUse default converter or specified converter from fopen
When width is specified for scanf, this acts like a non-NULL-terminated char * string.
By default, only one char is written.
%SUChar *UChar *Null terminated UTF-16 string
%CUCharUChar16-bit Unicode code unit
When width is specified for scanf, this acts like a non-NULL-terminated UChar * string
By default, only one codepoint is written.
%[] UChar *Null terminated UTF-16 string which contains the filtered set of characters specified by the UnicodeSet
%%  Show a percent sign
Format modifiers
modifierformatstypecomments
%h%d, %i, %o, %xint16_tshort format
%h%uuint16_tshort format
%hcchar(Unimplemented) Use invariant converter
%hschar *(Unimplemented) Use invariant converter
%hCchar(Unimplemented) 8-bit Unicode code unit
%hSchar *(Unimplemented) Null terminated UTF-8 string
%l%d, %i, %o, %xint32_tlong format (no effect)
%l%uuint32_tlong format (no effect)
%lcN/A(Unimplemented) Reserved for future implementation
%lsN/A(Unimplemented) Reserved for future implementation
%lCUChar32(Unimplemented) 32-bit Unicode code unit
%lSUChar32 *(Unimplemented) Null terminated UTF-32 string
%ll%d, %i, %o, %xint64_tlong long format
%ll%uuint64_t(Unimplemented) long long format
%-allN/ALeft justify
%+%d, %i, %o, %x, %e, %f, %g, %E, %GN/AAlways show the plus or minus sign. Needs data for plus sign.
% %d, %i, %o, %x, %e, %f, %g, %E, %GN/AInstead of a "+" output a blank character for positive numbers.
%#%d, %i, %o, %x, %e, %f, %g, %E, %GN/APrecede octal value with 0, hex with 0x and show the decimal point for floats.
%nallN/AWidth of input/output. num is an actual number from 0 to some large number.
%.n%e, %f, %g, %E, %F, %GN/ASignificant digits precision. num is an actual number from 0 to some large number.
If * is used in printf, then the precision is passed in as an argument before the number to be formatted.
printf modifier %* int32_t Next argument after this one specifies the width scanf modifier %* N/A This field is scanned, but not stored

If you are using this C API instead of the ustream.h API for C++, you can use one of the following u_fprintf examples to display a UnicodeString.


    UFILE *out = u_finit(stdout, NULL, NULL);
    UnicodeString string1("string 1");
    UnicodeString string2("string 2");
    u_fprintf(out, "%S\n", string1.getTerminatedBuffer());
    u_fprintf(out, "%.*S\n", string2.length(), string2.getBuffer());
    u_fclose(out);
*/ /** * When an end of file is encountered, this value can be returned. * @see u_fgetc * @stable 3.0 */ #define U_EOF 0xFFFF /** Forward declaration of a Unicode-aware file @stable 3.0 */ typedef struct UFILE UFILE; /** * Enum for which direction of stream a transliterator applies to. * @see u_fsettransliterator * @stable ICU 3.0 */ typedef enum { U_READ = 1, U_WRITE = 2, U_READWRITE =3 /* == (U_READ | U_WRITE) */ } UFileDirection; /** * Open a UFILE. * A UFILE is a wrapper around a FILE* that is locale and codepage aware. * That is, data written to a UFILE will be formatted using the conventions * specified by that UFILE's Locale; this data will be in the character set * specified by that UFILE's codepage. * @param filename The name of the file to open. * @param perm The read/write permission for the UFILE; one of "r", "w", "rw" * @param locale The locale whose conventions will be used to format * and parse output. If this parameter is NULL, the default locale will * be used. * @param codepage The codepage in which data will be written to and * read from the file. If this paramter is NULL the system default codepage * will be used. * @return A new UFILE, or NULL if an error occurred. * @stable ICU 3.0 */ U_DRAFT UFILE* U_EXPORT2 u_fopen(const char *filename, const char *perm, const char *locale, const char *codepage); /** * Open a UFILE on top of an existing FILE* stream. * @param f The FILE* to which this UFILE will attach. * @param locale The locale whose conventions will be used to format * and parse output. If this parameter is NULL, the default locale will * be used. * @param codepage The codepage in which data will be written to and * read from the file. If this paramter is NULL, data will be written and * read using the default codepage for locale, unless locale * is NULL, in which case the system default codepage will be used. * @return A new UFILE, or NULL if an error occurred. * @stable ICU 3.0 */ U_DRAFT UFILE* U_EXPORT2 u_finit(FILE *f, const char *locale, const char *codepage); /** * Create a UFILE that can be used for localized formatting or parsing. * The u_sprintf and u_sscanf functions do not read or write numbers for a * specific locale. The ustdio.h file functions can be used on this UFILE. * The string is usable once u_fclose or u_fflush has been called on the * returned UFILE. * @param stringBuf The string used for reading or writing. * @param capacity The number of code units available for use in stringBuf * @param locale The locale whose conventions will be used to format * and parse output. If this parameter is NULL, the default locale will * be used. * @return A new UFILE, or NULL if an error occurred. * @stable ICU 3.0 */ U_DRAFT UFILE* U_EXPORT2 u_fstropen(UChar *stringBuf, int32_t capacity, const char *locale); /** * Close a UFILE. * @param file The UFILE to close. * @stable ICU 3.0 */ U_DRAFT void U_EXPORT2 u_fclose(UFILE *file); /** * Tests if the UFILE is at the end of the file stream. * @param f The UFILE from which to read. * @return Returns TRUE after the first read operation that attempts to * read past the end of the file. It returns FALSE if the current position is * not end of file. * @stable ICU 3.0 */ U_DRAFT UBool U_EXPORT2 u_feof(UFILE *f); /** * Flush output of a UFILE. Implies a flush of * converter/transliterator state. (That is, a logical break is * made in the output stream - for example if a different type of * output is desired.) The underlying OS level file is also flushed. * @param file The UFILE to flush. * @stable ICU 3.0 */ U_DRAFT void U_EXPORT2 u_fflush(UFILE *file); /** * Rewind the file pointer to the beginning of the file. * @param file The UFILE to rewind. * @stable ICU 3.0 */ U_DRAFT void u_frewind(UFILE *file); /** * Get the FILE* associated with a UFILE. * @param f The UFILE * @return A FILE*, owned by the UFILE. The FILE must not be closed. * @stable ICU 3.0 */ U_DRAFT FILE* U_EXPORT2 u_fgetfile(UFILE *f); #if !UCONFIG_NO_FORMATTING /** * Get the locale whose conventions are used to format and parse output. * This is the same locale passed in the preceding call tou_fsetlocale * or u_fopen. * @param file The UFILE to set. * @return The locale whose conventions are used to format and parse output. * @stable ICU 3.0 */ U_DRAFT const char* U_EXPORT2 u_fgetlocale(UFILE *file); /** * Set the locale whose conventions will be used to format and parse output. * @param locale The locale whose conventions will be used to format * and parse output. * @param file The UFILE to query. * @return NULL if successful, otherwise a negative number. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fsetlocale(UFILE *file, const char *locale); #endif /** * Get the codepage in which data is written to and read from the UFILE. * This is the same codepage passed in the preceding call to * u_fsetcodepage or u_fopen. * @param file The UFILE to query. * @return The codepage in which data is written to and read from the UFILE, * or NULL if an error occurred. * @stable ICU 3.0 */ U_DRAFT const char* U_EXPORT2 u_fgetcodepage(UFILE *file); /** * Set the codepage in which data will be written to and read from the UFILE. * All Unicode data written to the UFILE will be converted to this codepage * before it is written to the underlying FILE*. It it generally a bad idea to * mix codepages within a file. This should only be called right * after opening the UFile, or after calling u_frewind. * @param codepage The codepage in which data will be written to * and read from the file. For example "latin-1" or "ibm-943. * A value of NULL means the default codepage for the UFILE's current * locale will be used. * @param file The UFILE to set. * @return 0 if successful, otherwise a negative number. * @see u_frewind * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fsetcodepage(const char *codepage, UFILE *file); /** * Returns an alias to the converter being used for this file. * @param f The UFILE to get the value from * @return alias to the converter * @stable ICU 3.0 */ U_DRAFT UConverter* U_EXPORT2 u_fgetConverter(UFILE *f); #if !UCONFIG_NO_FORMATTING /* Output functions */ /** * Write formatted data to a UFILE. * @param f The UFILE to which to write. * @param patternSpecification A pattern specifying how u_fprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode characters written to f. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fprintf(UFILE *f, const char *patternSpecification, ... ); /** * Write formatted data to a UFILE. * This is identical to u_fprintf, except that it will * not call va_start and va_end. * @param f The UFILE to which to write. * @param patternSpecification A pattern specifying how u_fprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters written to f. * @see u_fprintf * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vfprintf(UFILE *f, const char *patternSpecification, va_list ap); /** * Write formatted data to a UFILE. * @param f The UFILE to which to write. * @param patternSpecification A pattern specifying how u_fprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode characters written to f. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fprintf_u(UFILE *f, const UChar *patternSpecification, ... ); /** * Write formatted data to a UFILE. * This is identical to u_fprintf_u, except that it will * not call va_start and va_end. * @param f The UFILE to which to write. * @param patternSpecification A pattern specifying how u_fprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters written to f. * @see u_fprintf_u * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vfprintf_u(UFILE *f, const UChar *patternSpecification, va_list ap); #endif /** * Write a Unicode to a UFILE. The null (U+0000) terminated UChar* * s will be written to f, excluding the NULL terminator. * A newline will be added to f. * @param s The UChar* to write. * @param f The UFILE to which to write. * @return A non-negative number if successful, EOF otherwise. * @see u_file_write * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fputs(const UChar *s, UFILE *f); /** * Write a UChar to a UFILE. * @param uc The UChar to write. * @param f The UFILE to which to write. * @return The character written if successful, EOF otherwise. * @stable ICU 3.0 */ U_DRAFT UChar32 U_EXPORT2 u_fputc(UChar32 uc, UFILE *f); /** * Write Unicode to a UFILE. * The ustring passed in will be converted to the UFILE's underlying * codepage before it is written. * @param ustring A pointer to the Unicode data to write. * @param count The number of Unicode characters to write * @param f The UFILE to which to write. * @return The number of Unicode characters written. * @see u_fputs * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_file_write(const UChar *ustring, int32_t count, UFILE *f); /* Input functions */ #if !UCONFIG_NO_FORMATTING /** * Read formatted data from a UFILE. * @param f The UFILE from which to read. * @param patternSpecification A pattern specifying how u_fscanf will * interpret the variable arguments received and parse the data. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fscanf(UFILE *f, const char *patternSpecification, ... ); /** * Read formatted data from a UFILE. * This is identical to u_fscanf, except that it will * not call va_start and va_end. * @param f The UFILE from which to read. * @param patternSpecification A pattern specifying how u_fscanf will * interpret the variable arguments received and parse the data. * @param ap The argument list to use. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @see u_fscanf * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vfscanf(UFILE *f, const char *patternSpecification, va_list ap); /** * Read formatted data from a UFILE. * @param f The UFILE from which to read. * @param patternSpecification A pattern specifying how u_fscanf will * interpret the variable arguments received and parse the data. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_fscanf_u(UFILE *f, const UChar *patternSpecification, ... ); /** * Read formatted data from a UFILE. * This is identical to u_fscanf_u, except that it will * not call va_start and va_end. * @param f The UFILE from which to read. * @param patternSpecification A pattern specifying how u_fscanf will * interpret the variable arguments received and parse the data. * @param ap The argument list to use. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @see u_fscanf_u * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vfscanf_u(UFILE *f, const UChar *patternSpecification, va_list ap); #endif /** * Read one line of text into a UChar* string from a UFILE. The newline * at the end of the line is read into the string. The string is always * null terminated * @param f The UFILE from which to read. * @param n The maximum number of characters - 1 to read. * @param s The UChar* to receive the read data. Characters will be * stored successively in s until a newline or EOF is * reached. A null character (U+0000) will be appended to s. * @return A pointer to s, or NULL if no characters were available. * @stable ICU 3.0 */ U_DRAFT UChar* U_EXPORT2 u_fgets(UChar *s, int32_t n, UFILE *f); /** * Read a UChar from a UFILE. It is recommended that u_fgetcx * used instead for proper parsing functions, but sometimes reading * code units is needed instead of codepoints. * * @param f The UFILE from which to read. * @return The UChar value read, or U+FFFF if no character was available. * @stable ICU 3.0 */ U_DRAFT UChar U_EXPORT2 u_fgetc(UFILE *f); /** * Read a UChar32 from a UFILE. * * @param f The UFILE from which to read. * @return The UChar32 value read, or U_EOF if no character was * available, or U+FFFFFFFF if an ill-formed character was * encountered. * @see u_unescape() * @stable ICU 3.0 */ U_DRAFT UChar32 U_EXPORT2 u_fgetcx(UFILE *f); /** * Unget a UChar from a UFILE. * If this function is not the first to operate on f after a call * to u_fgetc, the results are undefined. * If this function is passed a character that was not recieved from the * previous u_fgetc or u_fgetcx call, the results are undefined. * @param c The UChar to put back on the stream. * @param f The UFILE to receive c. * @return The UChar32 value put back if successful, U_EOF otherwise. * @stable ICU 3.0 */ U_DRAFT UChar32 U_EXPORT2 u_fungetc(UChar32 c, UFILE *f); /** * Read Unicode from a UFILE. * Bytes will be converted from the UFILE's underlying codepage, with * subsequent conversion to Unicode. The data will not be NULL terminated. * @param chars A pointer to receive the Unicode data. * @param count The number of Unicode characters to read. * @param f The UFILE from which to read. * @return The number of Unicode characters read. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_file_read(UChar *chars, int32_t count, UFILE *f); #if !UCONFIG_NO_TRANSLITERATION /** * Set a transliterator on the UFILE. The transliterator will be owned by the * UFILE. * @param file The UFILE to set transliteration on * @param adopt The UTransliterator to set. Can be NULL, which will * mean that no transliteration is used. * @param direction either U_READ, U_WRITE, or U_READWRITE - sets * which direction the transliterator is to be applied to. If * U_READWRITE, the "Read" transliteration will be in the inverse * direction. * @param status ICU error code. * @return The previously set transliterator, owned by the * caller. If U_READWRITE is specified, only the WRITE transliterator * is returned. In most cases, the caller should call utrans_close() * on the result of this function. * @stable ICU 3.0 */ U_DRAFT UTransliterator* U_EXPORT2 u_fsettransliterator(UFILE *file, UFileDirection direction, UTransliterator *adopt, UErrorCode *status); #endif /* Output string functions */ #if !UCONFIG_NO_FORMATTING /** * Write formatted data to a Unicode string. * * @param buffer The Unicode String to which to write. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode code units written to buffer. This * does not include the terminating null character. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_sprintf(UChar *buffer, const char *patternSpecification, ... ); /** * Write formatted data to a Unicode string. When the number of code units * required to store the data exceeds count, then count code * units of data are stored in buffer and a negative value is * returned. When the number of code units required to store the data equals * count, the string is not null terminated and count is * returned. * * @param buffer The Unicode String to which to write. * @param count The number of code units to read. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode characters that would have been written to * buffer had count been sufficiently large. This does not include * the terminating null character. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_snprintf(UChar *buffer, int32_t count, const char *patternSpecification, ... ); /** * Write formatted data to a Unicode string. * This is identical to u_sprintf, except that it will * not call va_start and va_end. * * @param buffer The Unicode string to which to write. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters written to buffer. * @see u_sprintf * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsprintf(UChar *buffer, const char *patternSpecification, va_list ap); /** * Write formatted data to a Unicode string. * This is identical to u_snprintf, except that it will * not call va_start and va_end.

* When the number of code units required to store the data exceeds * count, then count code units of data are stored in * buffer and a negative value is returned. When the number of code * units required to store the data equals count, the string is not * null terminated and count is returned. * * @param buffer The Unicode string to which to write. * @param count The number of code units to read. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters that would have been written to * buffer had count been sufficiently large. * @see u_sprintf * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsnprintf(UChar *buffer, int32_t count, const char *patternSpecification, va_list ap); /** * Write formatted data to a Unicode string. * * @param buffer The Unicode string to which to write. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode characters written to buffer. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_sprintf_u(UChar *buffer, const UChar *patternSpecification, ... ); /** * Write formatted data to a Unicode string. When the number of code units * required to store the data exceeds count, then count code * units of data are stored in buffer and a negative value is * returned. When the number of code units required to store the data equals * count, the string is not null terminated and count is * returned. * * @param buffer The Unicode string to which to write. * @param count The number of code units to read. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @return The number of Unicode characters that would have been written to * buffer had count been sufficiently large. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_snprintf_u(UChar *buffer, int32_t count, const UChar *patternSpecification, ... ); /** * Write formatted data to a Unicode string. * This is identical to u_sprintf_u, except that it will * not call va_start and va_end. * * @param buffer The Unicode string to which to write. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters written to f. * @see u_sprintf_u * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsprintf_u(UChar *buffer, const UChar *patternSpecification, va_list ap); /** * Write formatted data to a Unicode string. * This is identical to u_snprintf_u, except that it will * not call va_start and va_end. * When the number of code units required to store the data exceeds * count, then count code units of data are stored in * buffer and a negative value is returned. When the number of code * units required to store the data equals count, the string is not * null terminated and count is returned. * * @param buffer The Unicode string to which to write. * @param count The number of code units to read. * @param patternSpecification A pattern specifying how u_sprintf will * interpret the variable arguments received and format the data. * @param ap The argument list to use. * @return The number of Unicode characters that would have been written to * f had count been sufficiently large. * @see u_sprintf_u * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsnprintf_u(UChar *buffer, int32_t count, const UChar *patternSpecification, va_list ap); /* Input string functions */ /** * Read formatted data from a Unicode string. * * @param buffer The Unicode string from which to read. * @param patternSpecification A pattern specifying how u_sscanf will * interpret the variable arguments received and parse the data. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_sscanf(const UChar *buffer, const char *patternSpecification, ... ); /** * Read formatted data from a Unicode string. * This is identical to u_sscanf, except that it will * not call va_start and va_end. * * @param buffer The Unicode string from which to read. * @param patternSpecification A pattern specifying how u_sscanf will * interpret the variable arguments received and parse the data. * @param ap The argument list to use. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @see u_sscanf * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsscanf(const UChar *buffer, const char *patternSpecification, va_list ap); /** * Read formatted data from a Unicode string. * * @param buffer The Unicode string from which to read. * @param patternSpecification A pattern specifying how u_sscanf will * interpret the variable arguments received and parse the data. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_sscanf_u(const UChar *buffer, const UChar *patternSpecification, ... ); /** * Read formatted data from a Unicode string. * This is identical to u_sscanf_u, except that it will * not call va_start and va_end. * * @param buffer The Unicode string from which to read. * @param patternSpecification A pattern specifying how u_sscanf will * interpret the variable arguments received and parse the data. * @param ap The argument list to use. * @return The number of items successfully converted and assigned, or EOF * if an error occurred. * @see u_sscanf_u * @stable ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 u_vsscanf_u(const UChar *buffer, const UChar *patternSpecification, va_list ap); #endif #endif