#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter)
#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase)
#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen)
+#define u_fopen_u U_ICU_ENTRY_POINT_RENAME(u_fopen_u)
#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit)
#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage)
#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError)
#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u)
#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf)
#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u)
+#define u_wfopen U_ICU_ENTRY_POINT_RENAME(u_wfopen)
#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun)
#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts)
#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close)
/*
******************************************************************************
*
-* Copyright (C) 1998-2013, International Business Machines
+* Copyright (C) 1998-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "unicode/ucnv.h"
+#include "unicode/ustring.h"
#include "cstring.h"
#include "cmemory.h"
return result; /* not a file leak */
}
+U_CAPI UFILE* U_EXPORT2
+u_fopen_u(const UChar *filename,
+ const char *perm,
+ const char *locale,
+ const char *codepage)
+{
+ UFILE *result;
+ char buffer[256];
+
+ u_austrcpy(buffer, filename);
+
+ result = u_fopen(buffer, perm, locale, codepage);
+#if U_PLATFORM_USES_ONLY_WIN32_API
+ /* Try Windows API _wfopen if the above fails. */
+ if (!result) {
+ FILE *systemFile = _wfopen(filename, (UChar*)perm);
+ if (systemFile) {
+ result = finit_owner(systemFile, locale, codepage, TRUE);
+ }
+ if (!result) {
+ /* Something bad happened.
+ Maybe the converter couldn't be opened. */
+ fclose(systemFile);
+ }
+ }
+#endif
+ return result; /* not a file leak */
+}
+
U_CAPI UFILE* U_EXPORT2
u_fstropen(UChar *stringBuf,
int32_t capacity,
const char *locale,
const char *codepage);
+/**
+ * Open a UFILE with a UChar* filename
+ * 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.
+ * @draft ICU 54
+ */
+U_DRAFT UFILE* U_EXPORT2
+u_fopen_u(const UChar *filename,
+ const char *perm,
+ const char *locale,
+ const char *codepage);
+
/**
* Open a UFILE on top of an existing FILE* stream. The FILE* stream
* ownership remains with the caller. To have the UFILE take over