perror
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <stdio.h>
|
||
| void perror( const char *s ); |
||
Печать на stderr содержание нулем строку символов, на которую указывает
s (если s является нулевым указателем), за которым следуют два символа ": ", после чего определяется реализацией сообщение об ошибке с описанием ошибки кода в настоящее время хранится в системной переменной errno (идентичный выходу strerror(errno)), а затем '\n'.Original:
Prints to stderr the contents of the null-terminated character string pointed to by
s (unless s is a null pointer), followed by the two characters ": ", followed by the implementation-defined error message describing the error code currently stored in the system variable errno (identical to the output of strerror(errno)), followed by '\n'.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Содержание |
[править] Параметры
| s | - | Указатель на завершающуюся нулем строку с пояснительной сообщении
Original: pointer to a null-terminated string with explanatory message The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[править] Возвращаемое значение
(Нет)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Пример
#include <fcntl.h> #include <stdio.h> int main() { if (open("non_existent", O_RDONLY) == -1) { perror("open()"); } }
Вывод:
open(): No such file or directory
[править] См. также
| возвращает текстовую версию заданного кода ошибки (функция) | |
| C++ документация для perror
| |