Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative api of strerror_r for windows OS

I see strerror_r(...) API is no longer supported in visual C++ 2008, probably because of issue with thread safety. I want to use similar functionality in my program. Is there any other winapi which does the same thing as strerror_r(..)?

like image 861
Manish Shukla Avatar asked Jul 30 '12 09:07

Manish Shukla


1 Answers

You can try strerror_s. It appears to be thread safe.

Note that the parameter order of strerror_s is different from strerror_r. If writing portable code you might want to use a define

#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
like image 97
Jay Avatar answered Oct 03 '22 09:10

Jay