这是一个说明问题的简单程序。
#include <string.h>
#include <iostream>
int main () {
char buf [30];
strerror_r (0, buf, sizeof (buf));
std :: cout << "strerror_r(0): " << buf << std :: endl;
std :: cout << "strerror(0): " << strerror (0) << std :: endl;
}
这是输出。
strerror_r(0):
strerror(0): Success
为什么里面什么都没有buf
?
(使用 gcc 在 Ubuntu 上编译。)