Now printf() is always real printf() and not #define'd to
PerlIO_stdoutf() so PerlIO_flush() when STDOUT is redirected
back to original file does not affect stdout unless we are
using :stdio as implementation. So things printf()ed XS side
are not written to file (and turn up at end of test).
So add an XS function which does fflush(stdout), modify .pm
file to export it and .t file to call it.
p4raw-id: //depot/perlio@18547
# Export everything since these functions are only used by a test script
our @EXPORT = qw( print_double print_int print_long
- print_float print_long_double have_long_double
+ print_float print_long_double have_long_double print_flush
);
-our $VERSION = '0.01';
+our $VERSION = '0.02';
bootstrap XS::APItest $VERSION;
float val
CODE:
printf("%5.3f\n",val);
+
+void
+print_flush()
+ CODE:
+ fflush(stdout);
print_float(4);
print_long_double() if $ldok; # val=7 hardwired
+print_flush();
+
# Now redirect STDOUT and read from the file
ok open(STDOUT, ">&", $oldout), "restore STDOUT";
ok open(my $foo, "<foo.out"), "open foo.out";
-print "# Test output by reading from file\n";
+#print "# Test output by reading from file\n";
# now test the output
my @output = map { chomp; $_ } <$foo>;
close $foo;