mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 22:04:26 +08:00
Add cross-platform fl_close_fd(int fd) to close a file descriptor
This commit is contained in:
@@ -179,6 +179,9 @@ FL_EXPORT int fl_open(const char *fname, int oflags, ...);
|
|||||||
|
|
||||||
FL_EXPORT int fl_open_ext(const char *fname, int binary, int oflags, ...);
|
FL_EXPORT int fl_open_ext(const char *fname, int binary, int oflags, ...);
|
||||||
|
|
||||||
|
/* Portable wrapper around unix-style close() function */
|
||||||
|
FL_EXPORT int fl_close_fd(int fd);
|
||||||
|
|
||||||
/* OD: Portable UTF-8 aware unlink wrapper */
|
/* OD: Portable UTF-8 aware unlink wrapper */
|
||||||
FL_EXPORT int fl_unlink(const char *fname);
|
FL_EXPORT int fl_unlink(const char *fname);
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -354,7 +354,7 @@ int fl_putenv(const char* var) {
|
|||||||
\param[in] oflags other arguments are as in the standard open() function
|
\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.
|
\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 fl_open(const char* fname, int oflags, ...) {
|
||||||
int pmode;
|
int pmode;
|
||||||
@@ -365,6 +365,14 @@ int fl_open(const char* fname, int oflags, ...) {
|
|||||||
return Fl::system_driver()->open(fname, oflags, pmode);
|
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.
|
/** Cross-platform function to open files with a UTF-8 encoded name.
|
||||||
|
|
||||||
In comparison with fl_open(), this function allows to control whether
|
In comparison with fl_open(), this function allows to control whether
|
||||||
|
|||||||
Reference in New Issue
Block a user