gpt4 book ai didi

c++ - 为什么 “strcat” 被认为是 “unsafe” ?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:56:51 35 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Why does MSVC++ consider “std::strcat” to be “unsafe”? (C++)

这是我的代码:

char sentence[ 100 ] = "";
char *article[ 5 ] = { "the", "a", "one", "some", "any" };

lexeme = rand() % 4; // random lexeme
strcat( sentence, article[ lexeme ] );
strcat( sentence, " " );

在 MSVC++ 中调试时,它会给我这些警告消息:

Warning 1   warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead.
Warning 2 warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead.

我该如何解决?

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