Annotation of embedaddon/php/ext/standard/tests/strings/vfprintf_basic1.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test vfprintf() function : basic functionality - string 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 string format ***\n";
                     11: 
                     12: // Initialise all required variables
                     13: $format = "format";
                     14: $format1 = "%s\n";
                     15: $format2 = "%s %s\n";
                     16: $format3 = "%s %s %s\n";
                     17: $arg1 = array("one");
                     18: $arg2 = array("one","two");
                     19: $arg3 = array("one","two","three");
                     20: 
                     21: 
                     22: /* creating dumping file */
1.1.1.2 ! misho      23: $data_file = dirname(__FILE__) . '/vfprintf_basic1.txt';
1.1       misho      24: if (!($fp = fopen($data_file, 'wt')))
                     25:    return;
                     26: 
                     27: $result = vfprintf($fp, $format1, $arg1);
                     28: var_dump($result);
                     29: $result = vfprintf($fp, $format2, $arg2);
                     30: var_dump($result);
                     31: $result = vfprintf($fp, $format3, $arg3);
                     32: var_dump($result);
                     33: 
                     34: fclose($fp);
                     35: print_r(file_get_contents($data_file));
                     36: 
                     37: unlink($data_file);
                     38: 
                     39: ?>
                     40: ===DONE===
                     41: --EXPECT--
                     42: *** Testing vfprintf() : basic functionality - using string format ***
                     43: int(4)
                     44: int(8)
                     45: int(14)
                     46: one
                     47: one two
                     48: one two three
                     49: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>