From 9d9f982ce8c77b246ac82074c5435b49fb80bf69 Mon Sep 17 00:00:00 2001 From: Scott Olsen Date: Tue, 19 Apr 2022 09:29:26 -0500 Subject: [PATCH] feat: add fputc wrapper to IO (#1417) * feat: add fputc wrapper to IO fputc is a low-level function that writes a single C character to a file. We can use this as a basis for more elegant APIs. The signature matches that of the C standard library function for compatibility, which takes an Int instead of a char. However, the documentation notes that the int argument is converted to an unsigned char. * doc: fix typos for fgetc and fputc docs --- core/IO.carp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/IO.carp b/core/IO.carp index e62e0718..dab0ced5 100644 --- a/core/IO.carp +++ b/core/IO.carp @@ -16,8 +16,10 @@ module are wrappers around the C standard library.") (register stderr (Ptr FILE) "stderr") (doc get-char "gets a character from stdin (thin wrapper for getchar() from C standard library).") (register get-char (Fn [] Int) "getchar") - (doc fgetc "gets a character from file (thin wrapper for the from C standard library).") + (doc fgetc "gets a character from file (thin wrapper for fgetc from the C standard library).") (register fgetc (Fn [(Ptr FILE)] Int) "fgetc") + (doc fputc "writes a character to a file (thin wrapper for fputc from the C standard library).") + (register fputc (Fn [Int (Ptr FILE)] Int) "fputc") (doc EOF "the End-Of-File character as a literal (thin wrapper for the C standard library)") (register EOF Int "EOF") (private fopen-)