安全,可移植的char数组功能? [英] Secure ,Portable char array functions ?
问题描述
HI,
是否有适用于MSVC ++函数的标准/便携式等效函数,例如:strncpy_s(),strcpy_s(),_ stricmp(),strcat_s(),sprintf_s(),fopen_s()等.
我正在将VC6应用程序移植到VC8,并获得有关非安全功能的警告音.我想用安全功能代替非安全功能.但是,到目前为止,我还没有找到一种便携式解决方案.我希望将便携式解决方案作为我的应用程序的一部分.与Unix连接,而其他人则与Windows连接.
预先表示感谢.
Is there a standard/Portable equivalent functions for MSVC++ functions like : strncpy_s(), strcpy_s(), _stricmp(), strcat_s(), sprintf_s(), fopen_s() etc.
I am porting a VC6 application to VC8, and getting tones of warnings regarding non-secure functions. I want to replace the non-secure functions with secure ones. But, till now i have not been able to find a portable solutions. I want a portable solution as some part of my app. connects with unix while others with windows.
Thanks in advance.
推荐答案
C ++的可移植方式是使用标准C ++库类std::string
和std::wstring
或可能的std::vector<char>
和std::vector<wchar_t>
使用std::copy_n
,std::find
等标准算法...
欢呼声,
AR
The C++ portable way is the use of the Standard C++ Library classesstd::string
andstd::wstring
or possiblystd::vector<char>
andstd::vector<wchar_t>
with Standard algorithms asstd::copy_n
,std::find
etc...
cheers,
AR
请参见此处 [
See here[^] for a possible solution.
这篇关于安全,可移植的char数组功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!