From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/io%2Fperror.html | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 devdocs/c/io%2Fperror.html (limited to 'devdocs/c/io%2Fperror.html') diff --git a/devdocs/c/io%2Fperror.html b/devdocs/c/io%2Fperror.html new file mode 100644 index 00000000..914c9153 --- /dev/null +++ b/devdocs/c/io%2Fperror.html @@ -0,0 +1,36 @@ +

perror

Defined in header <stdio.h>
void perror( const char *s );
+

Prints a textual description of the error code currently stored in the system variable errno to stderr.

+

The description is formed by concatenating the following components:

+

Parameters

+ +
s - pointer to a null-terminated string with explanatory message

Return value

(none)

+

Example

#include <stdio.h>
+ 
+int main(void)
+{
+    FILE *f = fopen("non_existent", "r");
+    if (f == NULL) {
+        perror("fopen() failed");
+    } else {
+        fclose(f);
+    }
+}

Possible output:

+
fopen() failed: No such file or directory

References

See also

+ +
+
(C11)(C11)
returns a text version of a given error code
(function)
C++ documentation for perror
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/io/perror +

+
-- cgit v1.2.3