#include <iostream>
#include <cerrno>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
// The following line does not compile on MSVS 2017:
// int bufferSize = strerrorlen_s(EINTR) + 1;
const int bufferSize = FILENAME_MAX;
char buffer[bufferSize];
strerror_s(buffer, bufferSize, EINTR);
cout << buffer << endl;
return 0;
}
// Output: Interrupted function call
Reference: http://en.cppreference.com/w/c/string/byte/strerror
Monday, December 4, 2017
C++17(C11)): Bounds-checking strerror_s() and strerrorlens()
C++17 added the bounds-checking functions strerror_s() and strerrorlens().
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment