Files
RedBear-OS/tests/stdio/fwrite.c
T
Red Bear OS 1b3e94a20d Red Bear OS relibc baseline
From release 0.1.0 pre-patched archive.
This includes all Red Bear modifications previously maintained
as patches in local/patches/relibc/.
2026-06-27 09:19:26 +03:00

28 lines
478 B
C

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "test_helpers.h"
int main(void) {
FILE *f = fopen("stdio/fwrite.out", "w");
ERROR_IF(fopen, f, == NULL);
const char ptr[] = "Hello World!";
if (fwrite(ptr, 0, 17, f)) {
exit(EXIT_FAILURE);
}
if (fwrite(ptr, 7, 0, f)) {
exit(EXIT_FAILURE);
}
if (fwrite(ptr, 0, 0, f)) {
exit(EXIT_FAILURE);
}
fwrite(ptr, sizeof(ptr), 1, f);
fclose(f);
}