gpt4 book ai didi

c++ - 为什么 strcpy_s 在我的系统中不存在?

转载 作者:太空狗 更新时间:2023-10-29 20:22:42 30 4
gpt4 key购买 nike

我在 Debian 8 系统上使用 clang。我有标准的 C++ 头文件。然而,没有 header 定义 strcpy_s。这是为什么?

# grep -iRHI 'strcpy_s' /usr 2>/dev/null
/usr/include/x86_64-linux-gnu/bits/string2.h: ? __strcpy_small (dest, __strcpy_args (src), \
/usr/include/x86_64-linux-gnu/bits/string2.h:__STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t,
/usr/include/x86_64-linux-gnu/bits/string2.h:__strcpy_small (char *__dest,
/usr/include/x86_64-linux-gnu/bits/string2.h:__STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2,
/usr/include/x86_64-linux-gnu/bits/string2.h:__strcpy_small (char *__dest,
/usr/src/broadcom-sta-6.30.223.248/src/include/bcmutils.h:#define bcm_strcpy_s(dst, noOfElements, src) strcpy((dst), (src))

最佳答案

Why does strcpy_s not exist anywhere on my system?

strcpy_s 不是由 C++ 标准库提供的。

strcpy_s 但是,自 C11 起由 C 标准指定。但即使在 C11 中,strcpy_s 也是可选的。所有标准库实现都不提供所有可选功能。所以,答案似乎是:因为您安装的所有 C 标准库都没有声明它。

How to I get strcpy_s, strtok_s, and all the other safe string functions onto my system?

您需要找到一个实现所有这些的库,或者自己实现它们。

关于c++ - 为什么 strcpy_s 在我的系统中不存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36723946/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com