65,210
社区成员
发帖
与我相关
我的任务
分享string strTm = strAllTxt;
int iLength = strTm.length();
char sendbuf[] = {0}; //[]这里面不能加变量,但我没有实现固定一个buf,需要计算得到,怎么办?
strcpy_s(sendbuf, strTm.c_str());
strcpy_s(sendbuf, iLength, strTm.c_str());
Infofile.Write(strTm.c_str(), strTm.length() + 1);
Infofile.Close();
string strTm = strAllTxt;
int iLength = strTm.length() + 1;
char * sendbuf = new char[iLength];
strcpy_s(sendbuf, strlen(sendbuf), strTm.c_str());
Infofile.Write(sendbuf, iLength);
Infofile.Close();
delete [] sendbuf; //这样有写有问题么?为什么会报错?
strcpy_s(sendbuf, strlen(sendbuf), strTm.c_str());
string strTm = strAllTxt;
int iLength = strTm.length();
char * sendbuf = new char[iLength];
strcpy_s(sendbuf, strTm.c_str()); //错误:“strcpy_s”: 函数不接受 2 个参数