(write_string): Simplified error check, it's no real point in
calling ferror unless we also call fflush.
Rev: src/nettle/examples/io.c:1.5
Rev: src/nettle/examples/io.h:1.3
res = fwrite(buffer, 1, size, f);
- if (res < size || ferror(f))
+ if (res < size)
res = 0;
- fclose(f);
+ return fclose(f) == 0 && res > 0;
+}
+
+int
+write_string(FILE *f, unsigned size, const char *buffer)
+{
+ size_t res = fwrite(buffer, 1, size, f);
return res > 0;
}
int
write_file(const char *name, unsigned size, const char *buffer);
+int
+write_string(FILE *f, unsigned size, const char *buffer);
+
int
simple_random(struct yarrow256_ctx *ctx, const char *name);