LINUXC file and directory print file operation error message

Source: Internet
Author: User

Print file operation error message

In the file operation, you will encounter errors such as insufficient permissions, files cannot be found, and you can set error capture statements and display errors in your program. Error trapping and error output are implemented using the error number and Streero.

Function Prototypes:

char *streeor (int errnum);

Header file

#include <string.h>

#include <errno.h>

Error codes for printing file operations machine information:

#include <stdio.h>
#include <string.h>
#include <errno.h>

int main (void)
{
int i = 0;
for (i=0; i <; i++)
{
printf ("errno:%d", I);
printf ("message:%s\n", strerror (i));
}
return 0;
}
[Email protected] exercise]$./error
errno:0 Message:success
Errno:1 Message:operation not permitted
Errno:2 message:no such file or directory
Errno:3 Message:no Such process
Errno:4 message:interrupted System call
Errno:5 message:input/output Error
Errno:6 Message:no such device or address
Errno:7 message:argument list too long
Errno:8 message:exec Format Error
Errno:9 Message:bad File Descriptor
Errno:10 Message:no Child Processes
Errno:11 Message:resource temporarily unavailable
Errno:12 Message:cannot Allocate Memory
Errno:13 Message:permission denied
Errno:14 Message:bad Address
Errno:15 Message:block Device required
Errno:16 Message:device or resource busy
Errno:17 Message:file exists
Errno:18 message:invalid Cross-device Link
Errno:19 Message:no such device
Errno:20 Message:not a directory
errno:21 Message:is a directory
errno:22 message:invalid argument
errno:23 Message:too Many open files in system
errno:24 Message:too many open files
ERRNO:25 message:inappropriate IOCTL for device
errno:26 message:text File Busy
Errno:27 Message:file too large
Errno:28 Message:no space left on device
errno:29 Message:illegal Seek
errno:30 message:read-only File System
Errno:31 Message:too Many links
ERRNO:32 Message:broken Pipe
Errno:33 message:numerical argument out of domain

LINUXC file and directory print file operation error message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.