【发布时间】:2010-04-22 17:20:05
【问题描述】:
我收到以下行的“strcpy”错误和警告:
_tcscpy(strCommandLine,_T("MyProgram.exe /param1"));
_tcscpy(strApplicationName,_T("MyProgram.exe"));
由于我没有使用“strcpy”,所以不确定为什么会收到“strcpy”错误或警告。与此相关的唯一行是:
LPCTSTR strApplicationName;
LPTSTR strCommandLine;
_tcscpy(strCommandLine,_T("MyProgram.exe /param1")); //warning is on this line
_tcscpy(strApplicationName,_T("MyProgram.exe")); //error is on this line
输出是:
1>c:\documents and settings\X.X\my documents\sandbox\sample.cpp(52) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\documents and settings\X.X\my documents\sandbox\sample.cpp(53) : error C2664: 'strcpy' : cannot convert parameter 1 from 'LPCTSTR' to 'char *'
1> Conversion loses qualifiers
对这意味着什么有什么想法吗?
这些是我的标题:
iostream
windows.h
stdio.h
tchar.h
winnt.h
【问题讨论】:
标签: c++ visual-c++