aboutsummaryrefslogtreecommitdiff
path: root/tests/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/write.c')
-rw-r--r--tests/write.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/write.c b/tests/write.c
new file mode 100644
index 0000000..5ccbc90
--- /dev/null
+++ b/tests/write.c
@@ -0,0 +1,22 @@
+#include <signal.h>
+#include <stdio.h>
+
+int main(void) {
+ FILE *fp = NULL;
+ int b = 1;
+ char c = '\0';
+ if ((fp = tmpfile()) == NULL) {
+ perror("tmpfile");
+ raise(SIGABRT);
+ }
+ for (;;b++) {
+ if (fwrite(&c, 1, 1, fp) == 0) {
+ perror("fwrite");
+ raise(SIGABRT);
+ }
+ if (b % 1000 == 0) {
+ fprintf(stderr, "Wrote %u octets\n", b);
+ }
+ }
+}
+