Lines Matching refs:myFile
27 static void TestFileFromICU(UFILE *myFile) {
45 if (myFile == NULL) {
67 u_fprintf(myFile, "Signed decimal integer %%d: %d\n", *n);
68 u_fprintf(myFile, "Signed decimal integer %%i: %i\n", *n);
69 u_fprintf(myFile, "Unsigned octal integer %%o: %o\n", *n);
70 u_fprintf(myFile, "Unsigned decimal integer %%u: %u\n", *n);
71 u_fprintf(myFile, "Lowercase unsigned hexadecimal integer %%x: %x\n", *n);
72 u_fprintf(myFile, "Uppercase unsigned hexadecimal integer %%X: %X\n", *n);
73 u_fprintf(myFile, "Float %%f: %f\n", myFloat);
74 u_fprintf(myFile, "Lowercase float %%e: %e\n", myFloat);
75 u_fprintf(myFile, "Uppercase float %%E: %E\n", myFloat);
76 u_fprintf(myFile, "Lowercase float %%g: %g\n", myFloat);
77 u_fprintf(myFile, "Uppercase float %%G: %G\n", myFloat);
78 u_fprintf(myFile, "Pointer %%p: %p\n", origPtr);
79 u_fprintf(myFile, "Char %%c: %c\n", 'A');
80 u_fprintf(myFile, "UChar %%C: %C\n", (UChar)0x0041); /*'A'*/
81 u_fprintf(myFile, "String %%s: %s\n", "My-String");
82 u_fprintf(myFile, "NULL String %%s: %s\n", NULL);
83 u_fprintf(myFile, "Unicode String %%S: %S\n", myStringOrig);
84 u_fprintf(myFile, "NULL Unicode String %%S: %S\n", NULL);
85 u_fprintf(myFile, "Percent %%P (non-ANSI): %P\n", myFloat);
86 u_fprintf(myFile, "Spell Out %%V (non-ANSI): %V\n", myFloat);
88 if (u_feof(myFile)) {
93 u_fprintf(myFile, "\t\nPointer to integer (Count) %%n: n=%d %n n=%d\n", *n, n, *n);
94 u_fprintf(myFile, "Pointer to integer Value: %d\n", *n);
95 u_fprintf(myFile, "This is a long test123456789012345678901234567890123456789012345678901234567890\n");
97 u_fprintf(myFile, "\tNormal fprintf count: n=%d %n n=%d\n", (int)*n, (int*)n, (int)*n);
98 fprintf(u_fgetfile(myFile), "\tNormal fprintf count value: n=%d\n", (int)*n); /* Should be 27 as stated later on. */
100 u_fclose(myFile);
101 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);
103 if (myFile == NULL) {
108 if (u_feof(myFile)) {
112 myUString[0] = u_fgetc(myFile);
116 u_fungetc(myUString[0], myFile);
117 myUString[0] = u_fgetc(myFile);
121 u_fungetc(myUString[0], myFile);
122 myUString[0] = u_fgetc(myFile);
126 u_fungetc(myUString[0], myFile);
127 myUString[0] = u_fgetc(myFile);
128 myUString[1] = (UChar)u_fgetcx(myFile); /* Mix getc and getcx and see what happens. */
129 myUString[2] = u_fgetc(myFile);
133 u_fungetc(myUString[2], myFile);
134 u_fungetc(myUString[1], myFile);
135 u_fungetc(myUString[0], myFile);
140 u_fscanf(myFile, "Signed decimal integer %%d: %d\n", newValuePtr);
145 u_fscanf(myFile, "Signed decimal integer %%i: %i\n", newValuePtr);
150 u_fscanf(myFile, "Unsigned octal integer %%o: %o\n", newValuePtr);
155 u_fscanf(myFile, "Unsigned decimal integer %%u: %u\n", newValuePtr);
160 u_fscanf(myFile, "Lowercase unsigned hexadecimal integer %%x: %x\n", newValuePtr);
165 u_fscanf(myFile, "Uppercase unsigned hexadecimal integer %%X: %X\n", newValuePtr);
170 u_fscanf(myFile, "Float %%f: %lf\n", newDoubleValuePtr);
175 u_fscanf(myFile, "Lowercase float %%e: %le\n", newDoubleValuePtr);
180 u_fscanf(myFile, "Uppercase float %%E: %lE\n", newDoubleValuePtr);
185 u_fscanf(myFile, "Lowercase float %%g: %lg\n", newDoubleValuePtr);
190 u_fscanf(myFile, "Uppercase float %%G: %lG\n", newDoubleValuePtr);
195 u_fscanf(myFile, "Pointer %%p: %p\n", &ptr);
199 u_fscanf(myFile, "Char %%c: %c\n", myString);
203 u_fscanf(myFile, "UChar %%C: %C\n", myUString);
207 u_fscanf(myFile, "String %%s: %s\n", myString);
211 u_fscanf(myFile, "NULL String %%s: %s\n", myString);
215 u_fscanf(myFile, "Unicode String %%S: %S\n", myUString);
220 u_fscanf(myFile, "NULL Unicode String %%S: %S\n", myUString);
226 u_fscanf(myFile, "Percent %%P (non-ANSI): %P\n", newDoubleValuePtr);
231 u_fscanf(myFile, "Spell Out %%V (non-ANSI): %V\n", newDoubleValuePtr);
236 u_fgets(myUString, 4, myFile);
244 if (u_fgets(myUString, sizeof(myUString)/sizeof(*myUString), myFile) != myUString) {
252 if (u_fgets(myUString, sizeof(myUString)/sizeof(*myUString), myFile) != myUString) {
260 if (u_fgets(myUString, sizeof(myUString)/sizeof(*myUString), myFile) != myUString) {
268 if (u_fgets(myUString, 0, myFile) != NULL) {
272 if (u_fgets(myUString, 1, myFile) != myUString) {
280 if (u_fgets(myUString, 2, myFile) != myUString) {
288 u_austrncpy(myString, u_fgets(myUString, sizeof(myUString)/sizeof(*myUString), myFile),
294 if (u_feof(myFile)) {
297 u_austrncpy(myString, u_fgets(myUString, sizeof(myUString)/sizeof(*myUString), myFile),
302 if (!u_feof(myFile)) {
305 if (u_fscanf(myFile, "%S\n", myUString) != 0) {
309 u_fclose(myFile);
357 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
358 if (myFile == NULL) {
362 if (u_fgetcodepage(myFile) == NULL
363 || strcmp(u_fgetcodepage(myFile), ucnv_getDefaultName()) != 0)
366 u_fgetcodepage(myFile), ucnv_getDefaultName());
369 if (u_fgetlocale(myFile) == NULL
370 || strcmp(u_fgetlocale(myFile), uloc_getDefault()) != 0)
373 u_fgetlocale(myFile), uloc_getDefault());
376 u_fclose(myFile);
378 myFile = u_fopen(STANDARD_TEST_FILE, "w", "es", NULL);
379 if (u_fgetcodepage(myFile) == NULL
380 || strcmp(u_fgetcodepage(myFile), ucnv_getDefaultName()) != 0)
383 u_fgetcodepage(myFile));
386 if (u_fgetlocale(myFile) == NULL
387 || strcmp(u_fgetlocale(myFile), "es") != 0)
390 u_fgetlocale(myFile), "es");
393 u_fclose(myFile);
395 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-16");
396 if (u_fgetcodepage(myFile) == NULL
397 || strcmp(u_fgetcodepage(myFile), "UTF-16") != 0)
400 u_fgetcodepage(myFile));
403 if (u_fgetlocale(myFile) == NULL
404 || strcmp(u_fgetlocale(myFile), uloc_getDefault()) != 0)
407 u_fgetlocale(myFile), uloc_getDefault());
410 u_fclose(myFile);
412 myFile = u_fopen(STANDARD_TEST_FILE, "w", "zh", "UTF-16");
413 if (u_fgetcodepage(myFile) == NULL
414 || strcmp(u_fgetcodepage(myFile), "UTF-16") != 0)
417 u_fgetcodepage(myFile));
420 if (u_fgetlocale(myFile) == NULL
421 || strcmp(u_fgetlocale(myFile), "zh") != 0)
424 u_fgetlocale(myFile), "zh");
427 u_fclose(myFile);
435 UFILE *myFile
440 if (myFile == NULL) {
445 u_fputc(0x3BC, myFile);
446 if (u_fputc(0x110000, myFile) != U_EOF) {
449 if (u_fputc((UChar32)0xFFFFFFFFu, myFile) != U_EOF) {
452 u_fputc(0xFF41, myFile);
457 u_file_write(buffer, expectedSize, myFile);
460 u_fclose(myFile);
463 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-16");
464 if (u_fgetc(myFile) != 0x3BC) {
467 if (u_fgetc(myFile) != 0xFF41) {
470 if (u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile) != buffer) {
484 if (strcmp(u_fgetcodepage(myFile), "UTF-16") != 0) {
485 log_err("Got %s instead of UTF-16\n", u_fgetcodepage(myFile));
487 u_fclose(myFile);
491 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
493 u_fputc(0x3BC, myFile);
494 u_fputc(0xFF41, myFile);
499 u_file_write(buffer, expectedSize, myFile);
502 u_fclose(myFile);
505 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
506 if (strcmp(u_fgetcodepage(myFile), "UTF-8") != 0) {
507 log_err("Got %s instead of UTF-8\n", u_fgetcodepage(myFile));
509 if (u_fgetc(myFile) != 0x3BC) {
512 if (u_fgetc(myFile) != 0xFF41) {
515 if (u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile) != buffer) {
529 u_fclose(myFile);
534 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
536 u_fputc(0xFF41, myFile);
541 u_file_write(buffer, expectedSize, myFile);
544 u_fclose(myFile);
547 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
548 if (u_fgets(buffer, 2, myFile) != buffer) {
562 u_fclose(myFile);
568 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-16");
574 u_file_write(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile);
577 u_fclose(myFile);
579 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-16");
580 how_many = u_file_read(buffer, 1024, myFile);
584 u_fclose(myFile);
592 UFILE *myFile = NULL;
612 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, NULL);
621 returnedUCharBuffer = u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile);
644 u_fclose(myFile);
681 UFILE *myFile = NULL;
684 myFile = u_fopen(STANDARD_TEST_FILE, "wb", NULL, "UTF-8");
685 if (myFile == NULL) {
690 u_file_write(testUStr[lineIdx], u_strlen(testUStr[lineIdx]), myFile);
692 u_fclose(myFile);
694 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, "UTF-8");
700 returnedUCharBuffer = u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile);
716 if (u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile) != NULL) {
719 u_fclose(myFile);
728 UFILE *myFile = NULL;
742 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, NULL);
743 if (myFile == NULL) {
750 returnedUCharBuffer = u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile);
759 returnedUCharBuffer = u_fgets(buffer, sizeof(buffer)/sizeof(buffer[0]), myFile);
775 u_fclose(myFile);
792 UFILE *myFile = NULL;
807 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, NULL);
808 if (myFile == NULL) {
814 returnedUCharBuffer = u_fgets(buffer, (sizeof(buffer)/sizeof(buffer[0]))-1, myFile);
824 u_fclose(myFile);
829 UFILE *myFile = NULL;
837 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "absurd converter that can't be opened");
839 if (myFile) {
841 u_fclose(myFile);
844 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "ISO-8859-1");
845 if (myFile == NULL) {
849 if (strcmp("ISO-8859-1", u_fgetcodepage(myFile)) != 0) {
852 u_file_write(strABAccentA, u_strlen(strABAccentA), myFile);
853 u_fclose(myFile);
856 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, NULL);
857 if (u_fsetcodepage("ISO-8859-1", myFile) != 0) {
860 retVal = u_file_read(testBuf, u_strlen(strABAccentA), myFile);
867 u_fclose(myFile);
870 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "ISO-8859-1");
871 if (strcmp(ucnv_getName(u_fgetConverter(myFile), &status), "ISO-8859-1") != 0) {
872 log_err("u_fgetConverter returned %s\n", ucnv_getName(u_fgetConverter(myFile), &status));
874 if (u_fsetcodepage("UTF-8", myFile) != 0) {
877 if (strcmp(ucnv_getName(u_fgetConverter(myFile), &status), "UTF-8") != 0) {
878 log_err("u_fgetConverter returned %s\n", ucnv_getName(u_fgetConverter(myFile), &status));
880 retVal = u_file_read(testBuf, u_strlen(strBadConversion), myFile);
884 u_fclose(myFile);
887 myFile
888 strcpy(convName, u_fgetcodepage(myFile));
889 u_file_read(testBuf, 1, myFile);
890 if (u_fsetcodepage("UTF-8", myFile) == 0) {
893 retVal = u_file_read(testBuf + 1, u_strlen(strABAccentA) - 1, myFile);
900 u_frewind(myFile);
901 retVal = u_file_read(testBuf, u_strlen(strABAccentA), myFile);
908 u_fclose(myFile);
920 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "wb", "en_US_POSIX", enc);
925 if (myFile == NULL) {
930 u_fprintf(myFile, "%S", utf16String);
931 u_fclose(myFile);
977 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "wb", "en_US_POSIX", NULL);
985 if (myFile == NULL) {
990 if (strcmp(u_fgetlocale(myFile), "en_US_POSIX") != 0) {
991 log_err("Got %s instead of en_US_POSIX for locale\n", u_fgetlocale(myFile));
997 u_fprintf(myFile, "%x ", num);
998 u_fprintf(myFile, "%X ", num);
999 u_fprintf(myFile, "%o ", num);
1000 u_fprintf(myFile, "%d ", num);
1001 u_fprintf(myFile, "%i ", num);
1002 u_fprintf(myFile, "%f ", (double)num);
1003 /* u_fprintf(myFile, "%e ", (double)num);
1004 u_fprintf(myFile, "%E ", (double)num);*/
1005 u_fprintf(myFile, "%g ", (double)num);
1006 u_fprintf(myFile, "%G", (double)num);
1007 u_fputs(emptyStr, myFile);
1010 u_fprintf_u(myFile, NEW_LINE);
1013 u_fprintf(myFile, "%c", num);
1016 u_fclose(myFile);
1112 myFile = u_fopen(STANDARD_TEST_FILE, "w", "en_US_POSIX", NULL);\
1113 if (myFile == NULL) {\
1121 uNumPrinted = u_fprintf(myFile, uFormat, uValue);\
1122 u_fclose(myFile);\
1123 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);\
1124 u_fgets(uBuffer, sizeof(uBuffer)/sizeof(*uBuffer), myFile);\
1125 u_fclose(myFile);\
1147 UFILE *myFile;
1254 myFile = u_fopen(STANDARD_TEST_FILE, "w", "en_US_POSIX", NULL);
1259 uNumPrinted = u_fprintf(myFile, "%d % d %d", -1234, 1234, 1234);
1260 u_fclose(myFile);
1261 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);
1262 u_fgets(uBuffer, sizeof(uBuffer)/sizeof(*uBuffer), myFile);
1263 u_fclose(myFile);
1282 UFILE *myFile;
1289 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
1290 if (myFile == NULL) {
1300 u_fprintf(myFile, "%S", uValue);
1301 u_fclose(myFile);
1302 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);
1303 uNumScanned = u_fscanf(myFile, format, uBuffer);
1304 u_fclose(myFile);
1372 UFILE *myFile;
1376 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
1377 if (myFile == NULL) {
1385 u_fprintf(myFile, "%S", uValue);
1386 u_fclose(myFile);
1387 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);
1388 uNumScanned = u_fscanf(myFile, format, uBuffer);
1389 u_fclose(myFile);
1409 UFILE *myFile;
1411 myFile = u_fopen(STANDARD_TEST_FILE, "w", "en_US_POSIX", "UTF-8");
1412 if (!myFile) {
1418 count = u_vfprintf(myFile, format, ap);
1421 u_fclose(myFile);
1424 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", "UTF-8");
1425 if (!myFile) {
1429 u_fgets(uBuffer, sizeof(uBuffer)/sizeof(*uBuffer), myFile);
1434 u_fclose(myFile);
1437 myFile = u_fopen(STANDARD_TEST_FILE, "w", "en_US_POSIX", NULL);
1438 if (!myFile) {
1445 count = u_vfprintf_u(myFile, uBuffer, ap);
1448 u_fclose(myFile);
1451 myFile = u_fopen(STANDARD_TEST_FILE, "r", "en_US_POSIX", NULL);
1452 if (!myFile) {
1456 u_fgets(uBuffer, sizeof(uBuffer)/sizeof(*uBuffer), myFile);
1461 u_fclose(myFile);
1474 UFILE *myFile;
1480 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
1481 if (!myFile) {
1485 u_fprintf_u(myFile, PERCENT_S, TEST_STR);
1486 u_fclose(myFile);
1488 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
1489 if (!myFile) {
1493 u_fscanf_u(myFile, PERCENT_S, myUString);
1494 u_fclose(myFile);
1503 UFILE * myFile;
1519 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, a_pszEncoding);
1520 if (!myFile) {
1526 count = u_file_write(buffer, expected, myFile);
1527 u_fclose(myFile);
1538 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, a_pszEncoding);
1539 if (!myFile) {
1544 UChar gotChar = u_fgetc(myFile);
1547 u_fclose(myFile);
1551 if (u_fgetc(myFile) != U_EOF) {
1553 u_fclose(myFile);
1556 u_fclose(myFile);