#include <stdio.h>
#include <stdarg.h>
#include "unicode/utypes.h"
#include "unicode/ucnv.h"
#include "unicode/utrans.h"
Go to the source code of this file.
Defines | |
#define | U_EOF 0xFFFF |
When an end of file is encountered, this value can be returned. | |
Typedefs | |
typedef UFILE | UFILE |
Forward declaration of a Unicode-aware file. | |
Enumerations | |
enum | UFileDirection { U_READ = 1, U_WRITE = 2, U_READWRITE = 3 } |
Enum for which direction of stream a transliterator applies to. More... | |
Functions | |
U_CAPI UFILE *U_EXPORT2 | u_fopen (const char *filename, const char *perm, const char *locale, const char *codepage) |
Open a UFILE. | |
U_CAPI UFILE *U_EXPORT2 | u_finit (FILE *f, const char *locale, const char *codepage) |
Open a UFILE on top of an existing FILE* stream. | |
U_CAPI UFILE *U_EXPORT2 | u_fstropen (UChar *stringBuf, int32_t capacity, const char *locale) |
Create a UFILE that can be used for localized formatting or parsing. | |
U_CAPI void U_EXPORT2 | u_fclose (UFILE *file) |
Close a UFILE. | |
U_CAPI UBool U_EXPORT2 | u_feof (UFILE *f) |
Tests if the UFILE is at the end of the file stream. | |
U_CAPI void U_EXPORT2 | u_fflush (UFILE *file) |
Flush output of a UFILE. | |
U_CAPI void | u_frewind (UFILE *file) |
Rewind the file pointer to the beginning of the file. | |
U_CAPI FILE *U_EXPORT2 | u_fgetfile (UFILE *f) |
Get the FILE* associated with a UFILE. | |
U_CAPI const char *U_EXPORT2 | u_fgetlocale (UFILE *file) |
Get the locale whose conventions are used to format and parse output. | |
U_CAPI int32_t U_EXPORT2 | u_fsetlocale (UFILE *file, const char *locale) |
Set the locale whose conventions will be used to format and parse output. | |
U_CAPI const char *U_EXPORT2 | u_fgetcodepage (UFILE *file) |
Get the codepage in which data is written to and read from the UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_fsetcodepage (const char *codepage, UFILE *file) |
Set the codepage in which data will be written to and read from the UFILE. | |
U_CAPI UConverter *U_EXPORT2 | u_fgetConverter (UFILE *f) |
Returns an alias to the converter being used for this file. | |
U_CAPI int32_t U_EXPORT2 | u_fprintf (UFILE *f, const char *patternSpecification,...) |
Write formatted data to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_vfprintf (UFILE *f, const char *patternSpecification, va_list ap) |
Write formatted data to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_fprintf_u (UFILE *f, const UChar *patternSpecification,...) |
Write formatted data to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_vfprintf_u (UFILE *f, const UChar *patternSpecification, va_list ap) |
Write formatted data to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_fputs (const UChar *s, UFILE *f) |
Write a Unicode to a UFILE. | |
U_CAPI UChar32 U_EXPORT2 | u_fputc (UChar32 uc, UFILE *f) |
Write a UChar to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_file_write (const UChar *ustring, int32_t count, UFILE *f) |
Write Unicode to a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_fscanf (UFILE *f, const char *patternSpecification,...) |
Read formatted data from a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_vfscanf (UFILE *f, const char *patternSpecification, va_list ap) |
Read formatted data from a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_fscanf_u (UFILE *f, const UChar *patternSpecification,...) |
Read formatted data from a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_vfscanf_u (UFILE *f, const UChar *patternSpecification, va_list ap) |
Read formatted data from a UFILE. | |
U_CAPI UChar *U_EXPORT2 | u_fgets (UChar *s, int32_t n, UFILE *f) |
Read one line of text into a UChar* string from a UFILE. | |
U_CAPI UChar U_EXPORT2 | u_fgetc (UFILE *f) |
Read a UChar from a UFILE. | |
U_CAPI UChar32 U_EXPORT2 | u_fgetcx (UFILE *f) |
Read a UChar32 from a UFILE. | |
U_CAPI UChar32 U_EXPORT2 | u_fungetc (UChar32 c, UFILE *f) |
Unget a UChar from a UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_file_read (UChar *chars, int32_t count, UFILE *f) |
Read Unicode from a UFILE. | |
U_CAPI UTransliterator *U_EXPORT2 | u_fsettransliterator (UFILE *file, UFileDirection direction, UTransliterator *adopt, UErrorCode *status) |
Set a transliterator on the UFILE. | |
U_CAPI int32_t U_EXPORT2 | u_sprintf (UChar *buffer, const char *patternSpecification,...) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_snprintf (UChar *buffer, int32_t count, const char *patternSpecification,...) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsprintf (UChar *buffer, const char *patternSpecification, va_list ap) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsnprintf (UChar *buffer, int32_t count, const char *patternSpecification, va_list ap) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_sprintf_u (UChar *buffer, const UChar *patternSpecification,...) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_snprintf_u (UChar *buffer, int32_t count, const UChar *patternSpecification,...) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsprintf_u (UChar *buffer, const UChar *patternSpecification, va_list ap) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsnprintf_u (UChar *buffer, int32_t count, const UChar *patternSpecification, va_list ap) |
Write formatted data to a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_sscanf (const UChar *buffer, const char *patternSpecification,...) |
Read formatted data from a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsscanf (const UChar *buffer, const char *patternSpecification, va_list ap) |
Read formatted data from a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_sscanf_u (const UChar *buffer, const UChar *patternSpecification,...) |
Read formatted data from a Unicode string. | |
U_CAPI int32_t U_EXPORT2 | u_vsscanf_u (const UChar *buffer, const UChar *patternSpecification, va_list ap) |
Read formatted data from a Unicode string. |
General printf format:
[format modifier][width][.precision][type modifier][format]
General scanf format:
[*][format modifier][width][type modifier][format]
format | default type | description |
E | double | Scientific with an uppercase exponent |
e | double | Scientific with a lowercase exponent |
G | double | Use E or f for best format |
g | double | Use e or f for best format |
f | double | Simple floating point without the exponent |
X | int32_t | ustdio special uppercase hex radix formatting |
x | int32_t | ustdio special lowercase hex radix formatting |
d | int32_t | Decimal format |
i | int32_t | Same as d |
n | int32_t | count (write the number of UTF-16 codeunits read/written) |
o | int32_t | ustdio special octal radix formatting |
u | uint32_t | Decimal format |
p | void * | Prints the pointer value |
s | char * | Use default converter or specified converter from fopen |
c | char | Use default converter or specified converter from fopen When width is specified, this acts like a non-NULL-terminated char * string. By default, only one char is written. |
S | UChar * | Null terminated UTF-16 string |
C | UChar | 16-bit Unicode code unit When width is specified, this acts like a non-NULL-terminated UChar * string By default, only one codepoint is written. |
[] | UChar * | (scanf only) Null terminated UTF-16 string which contains the filtered set of characters specified by the UnicodeSet |
% | N/A | Show a percent sign |
Format modifiers
modifier | formats | type | comments |
h | d, i, o, x | int16_t | short format |
h | u | uint16_t | short format |
h | c | char | (Unimplemented) Use invariant converter |
h | s | char * | (Unimplemented) Use invariant converter |
h | C | char | (Unimplemented) 8-bit Unicode code unit |
h | S | char * | (Unimplemented) Null terminated UTF-8 string |
l | d, i, o, x | int32_t | long format (no effect) |
l | u | uint32_t | long format (no effect) |
l | c | N/A | (Unimplemented) Reserved for future implementation |
l | s | N/A | (Unimplemented) Reserved for future implementation |
l | C | UChar32 | (Unimplemented) 32-bit Unicode code unit |
l | S | UChar32 * | (Unimplemented) Null terminated UTF-32 string |
ll | d, i, o, x | int64_t | long long format |
ll | u | uint64_t | (Unimplemented) long long format |
- | all | N/A | Left justify |
+ | d, i, o, x, e, f, g, E, G | N/A | Always show the plus or minus sign. Needs data for plus sign. |
d, i, o, x, e, f, g, E, G | N/A | Instead of a "+" output a blank character for positive numbers. | |
# | d, i, o, x, e, f, g, E, G | N/A | Precede octal value with 0, hex with 0x and show the decimal point for floats. |
n | all | N/A | Width of input/output. num is an actual number from 0 to some large number. |
.n | e, f, g, E, F, G | N/A | Significant 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
Definition in file ustdio.h.
|
When an end of file is encountered, this value can be returned.
|
|
Forward declaration of a Unicode-aware file.
|
|
Enum for which direction of stream a transliterator applies to.
|
|
Close a UFILE.
|
|
Tests if the UFILE is at the end of the file stream.
|
|
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.
|
|
Read a UChar from a UFILE.
It is recommended that
|
|
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
|
|
Returns an alias to the converter being used for this file.
|
|
Read a UChar32 from a UFILE.
|
|
Get the FILE* associated with a UFILE.
|
|
Get the locale whose conventions are used to format and parse output.
This is the same locale passed in the preceding call to
|
|
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
|
|
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.
|
|
Write Unicode to a UFILE. The ustring passed in will be converted to the UFILE's underlying codepage before it is written.
|
|
Open a UFILE on top of an existing FILE* stream.
|
|
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.
|
|
Write formatted data to a UFILE.
|
|
Write formatted data to a UFILE.
|
|
Write a UChar to a UFILE.
|
|
Write a Unicode to a UFILE.
The null (U+0000) terminated UChar*
|
|
Rewind the file pointer to the beginning of the file.
|
|
Read formatted data from a UFILE.
|
|
Read formatted data from a UFILE.
|
|
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
|
|
Set the locale whose conventions will be used to format and parse output.
|
|
Set a transliterator on the UFILE. The transliterator will be owned by the UFILE.
|
|
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.
|
|
Unget a UChar from a UFILE.
If this function is not the first to operate on
|
|
Write formatted data to a Unicode string.
When the number of code units required to store the data exceeds
|
|
Write formatted data to a Unicode string.
When the number of code units required to store the data exceeds
|
|
Write formatted data to a Unicode string.
|
|
Write formatted data to a Unicode string.
|
|
Read formatted data from a Unicode string.
|
|
Read formatted data from a Unicode string.
|
|
Write formatted data to a UFILE.
This is identical to
|
|
Write formatted data to a UFILE.
This is identical to
|
|
Read formatted data from a UFILE.
This is identical to
|
|
Read formatted data from a UFILE.
This is identical to
|
|
Write formatted data to a Unicode string.
This is identical to
|
|
Write formatted data to a Unicode string.
This is identical to
|
|
Write formatted data to a Unicode string.
This is identical to
|
|
Write formatted data to a Unicode string.
This is identical to
|
|
Read formatted data from a Unicode string.
This is identical to
|
|
Read formatted data from a Unicode string.
This is identical to
|