2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-02-13 17:55:24 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2019-02-27 18:39:32 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef _WIN32
|
|
|
|
#ifndef __STDC_LIB_EXT1__
|
|
|
|
#if __STDC_WANT_LIB_EXT1__ != 1
|
|
|
|
|
|
|
|
#include <cstdio>
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <errno.h>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-05-16 22:06:56 +08:00
|
|
|
inline int fopen_s(FILE **pFile, const char *filename, const char *mode) { // NOLINT(readability-identifier-naming)
|
2017-12-21 07:45:38 +08:00
|
|
|
if ((pFile == nullptr) || (filename == nullptr) || (mode == nullptr)) {
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pFile = fopen(filename, mode);
|
|
|
|
if (*pFile == nullptr) {
|
|
|
|
return -errno;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|