File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -934,9 +934,9 @@ end function stdlib_is_directory
934
934
935
935
end function is_directory
936
936
937
- ! A helper function to get the result of the C function `strerror` .
938
- ! `strerror ` is a function provided by `<string.h>`.
939
- ! It returns a string describing the meaning of `errno` in the C header `<errno.h>`
937
+ ! A helper function to get the string describing an error from C functions .
938
+ ! If `winapi ` is false or not present, uses `strerror` provided by `<string.h>`
939
+ ! Otherwise, uses `strerror` on unix and `FormatMessageA` on windows.
940
940
function c_get_strerror (winapi ) result(str)
941
941
character (len= :), allocatable :: str
942
942
logical , optional , intent (in ) :: winapi
Original file line number Diff line number Diff line change 12
12
#endif /* ifdef _WIN32 */
13
13
14
14
// Wrapper to get the string describing a system syscall error.
15
- // Uses `strerr` on unix.
15
+ // Always Uses `strerr` on unix.
16
16
// if `winapi` is `false`, uses the usual `strerr` on windows.
17
- // If `winapi` is `false `, uses `FormatMessage `(from windows.h) on windows.
17
+ // If `winapi` is `true `, uses `FormatMessageA `(from windows.h) on windows.
18
18
char * stdlib_strerror (size_t * len , bool winapi ){
19
19
20
20
if (winapi ) {
21
21
#ifdef _WIN32
22
22
LPSTR err = NULL ;
23
23
DWORD dw = GetLastError ();
24
24
25
- FormatMessage (
25
+ FormatMessageA (
26
26
FORMAT_MESSAGE_ALLOCATE_BUFFER |
27
27
FORMAT_MESSAGE_FROM_SYSTEM |
28
28
FORMAT_MESSAGE_IGNORE_INSERTS ,
You can’t perform that action at this time.
0 commit comments