On this page
  1. strerror
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

strerror

Prev: strstr | Up: string.h | Next: strdup
Rel: string.h, stdlib.h & string.h Guide
Ref: cppreference — strerror
Tags: #public #prog #c #stdlib #string #tier/standard


Include

#include <string.h>

Signature & Overview

char *strerror(int errnum);

Maps an errno integer to a human-readable error message string.

Notes & Pitfalls

Example

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

int main(void) {
    const char *msg = strerror(ENOENT);
    assert(msg != NULL && strlen(msg) > 0);
}

Linked from

Related notes