将perror输出重定向到fprintf(stderr,“”)

如果系统调用函数失败,我们通常使用perror来输出错误消息。 我想使用fprintf输出perror字符串。 我该怎么做这样的事情:

fprintf(stderr, perror output string here); 

 #include  fprintf(stderr, "%s\n", strerror(errno)); 

注意:strerror不适用于消息的末尾