본문 바로가기
C/C Library

strerror

by memora 2024. 7. 4.

Index로 돌아가기

 

【기  능】 에러번호에 해당하는 에러 메시지를 취득하는 기능

【소  속】 string.h     
           #include <string.h>    

【서  식】 char *strerror(int errnum);    

【설  명】 에러번호 errnum에 해당하는 에러 메시지의 선두포인터를 돌려준다.

【인  수】      
           errnum : 에러번호

【리턴 값】
           에러 메시지 문자열의 포인터

【사용 예】 
#include <stdio.h>
#include <string.h>
#include <stdint.h>

int main()
{
    int errno;

    // 에러번호 0~40의 에러 메시지를 취득한다
    for(errno = 0; errno <= 40; errno++){

        printf("에러 %02d : %s\n", errno, strerror(errno));
    }

    return 0;
}

【결   과】 
에러 00 : No error
에러 01 : Operation not permitted
에러 02 : No such file or directory
에러 03 : No such process
에러 04 : Interrupted function call
에러 05 : Input/output error
에러 06 : No such device or address
에러 07 : Arg list too long
에러 08 : Exec format error
에러 09 : Bad file descriptor
에러 10 : No child processes
에러 11 : Resource temporarily unavailable
에러 12 : Not enough space
에러 13 : Permission denied
에러 14 : Bad address
에러 15 : Unknown error
에러 16 : Resource device
에러 17 : File exists
에러 18 : Improper link
에러 19 : No such device
에러 20 : Not a directory
에러 21 : Is a directory
에러 22 : Invalid argument
에러 23 : Too many open files in system
에러 24 : Too many open files
에러 25 : Inappropriate I/O control operation
에러 26 : Unknown error
에러 27 : File too large
에러 28 : No space left on device
에러 29 : Invalid seek
에러 30 : Read-only file system
에러 31 : Too many links
에러 32 : Broken pipe
에러 33 : Domain error
에러 34 : Result too large
에러 35 : Unknown error
에러 36 : Resource deadlock avoided
에러 37 : Unknown error
에러 38 : Filename too long
에러 39 : No locks available
에러 40 : Function not implemented

 

※error내용은 컴파일러나 사용 IDE에 따라서 변경될 수 있다.

※위 내용은 「Code :: Block ver20.03」 GNU GCC Compiler를 사용해서 출력

 

Index로 돌아가기

반응형

'C > C Library' 카테고리의 다른 글

strspn  (1) 2024.07.08
strpbrk  (0) 2024.07.06
strrchr  (0) 2024.07.03
strncmp  (1) 2024.06.25
strcat  (0) 2024.06.22