Annotation of embedaddon/php/ext/standard/tests/strings/vfprintf_basic9.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test vfprintf) function : basic functionality - hexadecimal format
3: --FILE--
4: <?php
5: /* Prototype : int vfprintf ( resource $handle , string $format , array $args )
6: * Description: Write a formatted string to a stream
7: * Source code: ext/standard/formatted_print.c
8: */
9:
10: echo "*** Testing vfprintf) : basic functionality - using hexadecimal format ***\n";
11:
12: // Initialising different format strings
13: $format = "format";
14: $format1 = "%x";
15: $format2 = "%x %x";
16: $format3 = "%x %x %x";
17:
18: $format11 = "%X";
19: $format22 = "%X %X";
20: $format33 = "%X %X %X";
21:
22: $arg1 = array(11);
23: $arg2 = array(11,132);
24: $arg3 = array(11,132,177);
25:
26: /* creating dumping file */
27: $data_file = dirname(__FILE__) . '/dump.txt';
28: if (!($fp = fopen($data_file, 'wt')))
29: return;
30:
31: vfprintf($fp, $format1, $arg1);
32: fprintf($fp, "\n");
33: vfprintf($fp, $format11, $arg1);
34: fprintf($fp, "\n");
35:
36: vfprintf($fp, $format2, $arg2);
37: fprintf($fp, "\n");
38: vfprintf($fp, $format22, $arg2);
39: fprintf($fp, "\n");
40:
41: vfprintf($fp, $format3, $arg3);
42: fprintf($fp, "\n");
43: vfprintf($fp, $format33, $arg3);
44: fprintf($fp, "\n");
45:
46: fclose($fp);
47: print_r(file_get_contents($data_file));
48:
49: unlink($data_file);
50: ?>
51: ===DONE===
52: --EXPECT--
53: *** Testing vfprintf) : basic functionality - using hexadecimal format ***
54: b
55: B
56: b 84
57: B 84
58: b 84 b1
59: B 84 B1
60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>