Borland C++ reference

_strerror

raw OCR

Builds a customized error message.

Defined in header <string.h>

Syntax

#include <string.h>
char *strerrorCconst char '*"s);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

_strerror allows you to generate customized error messages; it returns a pointer to a null-terminated string containing an error message.

□ If s is null, the return value points to the most recent error message. □ If s is not mill, the return value contains s (your customized error message), a colon, a space, the most-recently generated system error message, and a new line, s should be 94 characters or less.

_strerror is the same as strerror in version 1.0 of Turbo C.

Return value

_strerror returns a pointer to a constructed error string. The error message string is constructed in a static buffer that is overwritten with each call to _strerror.

See also

Example

#include <stdio.h>

int main(void)

   FILE *fp;
   /* open a file for writing  */
   fp = fopen("TEST.$$$",  "w");

   /* force an error condition by  attempting to read */
   if (!fp) fgetc(fp);
   if (ferror(fp))
      /* display a custom error message  */
      printf("%s", _strerror ("Custom"));
   fclose(fp);
return

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `strerror` read as `_strerror`