ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxÖдíÎóÂë¼°ÃèÊö

·¢²¼Ê±¼ä:2008-02-25 15:27:13À´Ô´:ºìÁª×÷Õß:Number
ÓÉÓÚ¹¤×÷µÄ¹Øϵ£¬×î½üÒ»Ö±ÔÚÓÃLinux£¬¹ý³ÌÖÐÒ²Óöµ½¹ý²»ÉÙÎÊÌ⣬ͨ¹ýÕÒ×ÊÁÏ£¬Ïë°ì·¨£¬×îÖÕ¶¼ÄܵÃÒѽâ¾ö£¬½ñÌì½â¾öµÄÎÊÌâ±ãÊÇLinuxÉÏ´íÎóÂëµÄÎÊÌ⡣ÿ´ÎÔËÐÐÒ»¸öÃüÁLinux¶¼»á·µ»ØÒ»¸ö´íÎóÂë(ÕûÊý£¬Ò»°ãΪ0~256)£¬ÄÇôÕâЩÊý×Ö¶¼±íʾʲôÒâ˼ÄØ£¿½ñÌìÇ¿×Ó¸æËß´ó¼Ò3ÖÖ·½·¨(×¢£ºÎÒµÄƽ̨µÄFedora 7£¬ÆäËûƽ̨¿É²Î¿¼)£º

1. ¼òµ¥Ã÷ÁË£¬Ò»¸öÃüÁÏ뿴ʲô¿´Ê²Ã´£º

# perror
Èç# perror 0 ±íʾSuccess, #perror 1±íʾOperation not permitted

2. Ö±½Ó¿´CÎļþÀïµÄ¶¨Ò壺
# more /usr/include/asm-generic/errno-base.h (»ù±¾´íÎ󣬴Ó0µ½34)
# more /usr/include/asm-generic/errno.h (À©Õ¹´íÎ󣬴Ó35µ½131)

3. д¸öC³ÌÐòÀ´ÇÆÇÆ£º
# 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));

}

}[/code]# gcc errorlist.c ±àÒë¸ÃCÎļþ

# ./a.out Ö´ÐУ¬²é¿´Êä³ö½á¹û

ÆäʵÓеĶ«Î÷ÕæµÄºÜ¼òµ¥£¬Ö»Êǵ±Äã²»µÃÆäÃŶøÈëʱ£¬Ö»ÄÜÍûÑóÐË̾!
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. yanfei163 ÓÚ 2008-02-26 23:23:15·¢±í:

    ºÃÌù ¶¥Ò»¸ö