#define f_macro_file_type_is_link(mode) f_macro_file_type_get(mode) == f_file_type_link
#define f_macro_file_type_is_regular(mode) f_macro_file_type_get(mode) == f_file_type_regular
#define f_macro_file_type_is_socket(mode) f_macro_file_type_get(mode) == f_file_type_socket
+
+ #define f_macro_file_open_mode_append "a"
+ #define f_macro_file_open_mode_read "r"
+ #define f_macro_file_open_mode_read_append "a+"
+ #define f_macro_file_open_mode_read_truncate "w+"
+ #define f_macro_file_open_mode_read_write "r+"
+ #define f_macro_file_open_mode_truncate "w"
#endif // _di_f_file_type_
/**
if (flag & f_file_flag_read_write) {
if (flag & f_file_flag_truncate) {
- return "w+";
+ return f_macro_file_open_mode_read_truncate;
}
else if (flag & f_file_flag_append) {
- return "a+";
+ return f_macro_file_open_mode_read_append;
}
// failsafe to read write prepend.
- return "r+";
+ return f_macro_file_open_mode_read_write;
}
else if (flag & f_file_flag_write_only) {
if (flag & f_file_flag_truncate) {
- return "w";
+ return f_macro_file_open_mode_truncate;
}
// failsafe to append.
- return "a";
+ return f_macro_file_open_mode_append;
}
// failsafe to read only.
- return "r";
+ return f_macro_file_open_mode_read;
}
#endif // !defined(_di_f_file_stream_descriptor_) || !defined(_di_f_file_stream_open_) || !defined(_di_f_file_stream_reopen_)