- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在 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/
我想输出三个国家首字母中最小的字母,这是代码: #include #include using namespace std; int main() { void smallest_string
我在使用 strcpy_s 时遇到一些错误,无法弄清楚我做错了什么。 代码: 播放器.hpp: string name; Player(string); 播放器.cpp: Player::Player
我正在尝试使用 strcpy_s,但我遇到了这个错误: Unhandled Exception... struct Item { //Item's int code; // Code
众所周知,strcpy_s是strcpy的安全版本。 但我想知道它是如何工作的...... 让我们看一些例子。 strpy_s的声明: errno_t strcpy_s(_CHAR *_DEST, s
我有一个 C++11 项目,并且添加了一些 strcpy_s 方法调用。这在windows上可行,但是在gcc上编译时,出现错误指出未找到 strcpy_s 符号。 我确实添加了该行 #define
我只是想将“temp”中的内容复制到“p”中,但程序在 strcopy_s 行崩溃了。我是否遗漏了一些重要的规则? #include #include #include using namesp
我感觉我一直都是用strcpy来复制字符串,没有任何问题,但是我已经很久没用了,现在怎么弄都搞不定。 我确定我遗漏了一些愚蠢的东西,但我对此感到沮丧有一段时间了,所以我来这里看看是否还有其他人可以提供
出于某种原因,一个字符不能进入 strcopy_s();... #include #include using namespace std; struct DATE { int year;
我想知道我是否可以安全地替换此处定义的 strcpy_s https://msdn.microsoft.com/en-us/library/td1esda9.aspx - (有两个参数的)在这里定义了
尝试使用 strcpy_s 复制字符串 char foo[10]; // a buffer able to hold 9 chars (plus the null) char bar[] = "A
我需要将std::string 数据 复制到一个char 数组中。我的字符串的长度是可变的,但我的 char 数组的长度是固定的。 const int SIZE = 5; char name[SIZE
我正在尝试使用更安全的 strcpy_s 更新对 strcpy 的调用。旧函数调用如下所示: char buf[6]; strcpy(buf+1, "%#c"); 为了将上面的代码变成更安全的版本,我
我有一个 C++11 项目,我添加了一些 strcpy_s 方法调用。这适用于Windows,但是在gcc 上编译时,会出现错误声明未找到 strcpy_s 符号。 我确实添加了行 #define _
我是 C++ 新手。我正在编写以下简单代码。我想将字符 [40] 传递给一个函数,然后得到与输出相同的值。如果我在以下位置进行调试。 strcpy_s(x,100,测试仪); 但如果我写“This i
我在 Debian 8 系统上使用 clang。我有标准的 C++ 头文件。然而,没有 header 定义 strcpy_s。这是为什么? # grep -iRHI 'strcpy_s' /usr 2
运行代码后,出现如下错误。如何用 strcpy_s 替换 strcpy?谢谢你的帮助。而且当我尝试直接用 strcpy_s 替换 strcpy 时,它说命名空间“std”没有成员“strcpy_s”。
这个问题在这里已经有了答案: How to find the size of an array (from a pointer pointing to the first element array
我正在尝试使用 VS 2013 在 C++ 中连接两个字符串。下面是代码: char *stringOne = "Hello"; char *stringTwo = " There!"; char *
我的目标是生成一个具有正确数量点的新数组,并将一个旧字符数组复制到其中。 使用strcpy_s时,抛出异常。我不明白为什么会抛出异常,指出缓冲区太小。我不能使用 vector 或字符串。如何使用 st
我在这条线上有缓冲问题 strcpy_s(*(pWords + word_count), word_length, pWord); 我正在尝试从 argv[1] 中读取一个文件并打印出该文件中的每个单
我是一名优秀的程序员,十分优秀!