summaryrefslogtreecommitdiff
path: root/src/fl_utf8.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-17 19:13:30 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-17 19:13:30 +0100
commitb9852ff58fb528e505d46f3e68f3ab14b2e32fa7 (patch)
treee7564989a5400303fc40441e41d12e8dd5d90fd3 /src/fl_utf8.cxx
parent5b6d5f9279eb2410bf56cd621c96ac54322ac8bc (diff)
Add cross-platform fl_close_fd(int fd) to close a file descriptor
Diffstat (limited to 'src/fl_utf8.cxx')
-rw-r--r--src/fl_utf8.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx
index b7801207e..6028f3172 100644
--- a/src/fl_utf8.cxx
+++ b/src/fl_utf8.cxx
@@ -354,7 +354,7 @@ int fl_putenv(const char* var) {
\param[in] oflags other arguments are as in the standard open() function
\return a file descriptor upon successful completion, or -1 in case of error.
- \see fl_fopen(), fl_open_ext().
+ \see fl_fopen(), fl_open_ext(), fl_close_fd(int fd).
*/
int fl_open(const char* fname, int oflags, ...) {
int pmode;
@@ -365,6 +365,14 @@ int fl_open(const char* fname, int oflags, ...) {
return Fl::system_driver()->open(fname, oflags, pmode);
}
+/** Cross-platform function to close a file descriptor.
+ \return 0 in case of success, or -1 in case of error.
+ */
+
+int fl_close_fd(int fd) {
+ return Fl::system_driver()->close_fd(fd);
+}
+
/** Cross-platform function to open files with a UTF-8 encoded name.
In comparison with fl_open(), this function allows to control whether