...
Non-Compliant Code Example: fopen_s()
(ISO/IEC TR 24731-1)
Wiki Markup |
---|
The |
fopen_s()
function defined in ISO/IEC TR 24731-1 |
fopen()
function. However, like fopen()
, {{fopen_s()}} function is designed to improve the security of the {{fopen()}} function \[[ISO/IEC TR 24731-1:2007|AA. C References#SO/IEC TR 24731-1-2007]\]. However, like {{fopen()}}, {{fopen_s()}} provides no mechanism to determine if an existing file has been opened for writing or a new file has been created. |
Code Block | ||
---|---|---|
| ||
char *file_name; FILE *fp; /* initialize file_name */ errno_t res = fopen_s(&fp, file_name, "w"); if (res != 0) { /* handle error */ } |
...