perl 5.003_05: t/io/read.t
Perl 5 Porters [Tue, 3 Sep 1996 01:53:21 +0000 (01:53 +0000)]
Clear any buffer space exposed by by read().
This is almost certainly a bug-fix.

t/io/read.t [new file with mode: 0644]

diff --git a/t/io/read.t b/t/io/read.t
new file mode 100644 (file)
index 0000000..16d32b1
--- /dev/null
@@ -0,0 +1,22 @@
+#!./perl
+
+# $RCSfile$
+
+print "1..1\n";
+
+open(A,"+>a");
+print A "_";
+seek(A,0,0);
+
+$b = "abcd"; 
+$b = "";
+
+read(A,$b,1,4);
+
+close(A);
+
+if ($b eq "\000\000\000\000_") {
+       print "ok 1\n";
+} else { # Probably "\000bcd_"
+       print "not ok 1\n";
+}