This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/streln_s.c

20 lines
442 B
C
Raw Normal View History

#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>
#include <string.h>
#include <errno.h>
void main()
{
FILE *fp;
char emsg[ 100 ];
size_t emsglen;
fp = fopen( "file.nam", "r" );
if( fp == NULL ) {
emsglen = strerrorlen_s( errno );
printf( "Length of errormessage: %d\n", emsglen );
strerror_s( emsg, sizeof( emsg ), errno );
printf( "Unable to open file: %s\n", emsg );
}
}