Linux-common Linux technology-Linux programming and kernel information. Due to the working relationship, I have been using Linux recently and encountered many problems in the process. By looking for information and finding a solution, I can finally solve the problem, the problem solved today is the error code on Linux. Each time you run a command, Linux returns an error code (integer, usually 0 ~ 256). What do these numbers mean? Today, we have learned three ways to use this feature (for more information, see Fedora 7 on my platform ):
1. simple and clear, a command, what do you want to see:
# Perror
For example, # perror 0 indicates Success, # perror 1 indicates Operation not permitted
2. view the definition in file C directly:
# More/usr/include/asm-generic/errno-base.h (basic error, from 0 to 34)
# More/usr/include/asm-generic/errno. h (expansion error, from 35 to 131)
3. Write a C program:
# Vi errorlist. c
CODE: # include
# Include
# Include
Int main ()
{
Int I;
For (I = 0; I <257; I ++)
{
Printf ("Error # % d: % s \ n", I, strerror (I ));
}
} |