本文整理汇总了C++中StringObject::strcpy方法的典型用法代码示例。如果您正苦于以下问题:C++ StringObject::strcpy方法的具体用法?C++ StringObject::strcpy怎么用?C++ StringObject::strcpy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringObject
的用法示例。
在下文中一共展示了StringObject::strcpy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readMimeResponse
//////////////////////////
// Read header & populate string with body
//////////////////////////
bool CMimeProtocol::readMimeResponse(int link,CHARPTR headers,int size,StringObject& content)
{
CHAR buffer[CBUFF_HUGE+2];
CHARPTR ptrHeadEnd;
CHARPTR ptrContLen;
int read=0;
int bytes;
// 1st read headers
while(true){
// Wait
if(!waitForEvent(link,10000)){
content.strcpy(headers);
return read > 0;
}
// Read next lot
if((bytes = recvTcp(link,&headers[read],size-read)) <= 0)
return false;
read+=bytes;
headers[read]=0;
// Check for header & body
ptrHeadEnd=strstr(headers,"\r\n\r\n");
// No header yet
if(ptrHeadEnd)
break;
}
ptrContLen=strstr(headers,"Content-Length: ");
int contentLength;
// Terminate
*ptrHeadEnd=0;
// Header & nobody - copy headers
if(!ptrContLen){
// Just keep reading until server closes connection
contentLength=128000;
content.strcpy(headers);
}
else{
// Get content length
if(!strparse(ptrContLen,"Content-Length: %1d",&contentLength))
return false;
// Skip to start of body
ptrHeadEnd += strlen("\r\n\r\n");
content.strcpy(ptrHeadEnd);
}
// Calculate remaining
read = strlen(ptrHeadEnd);
while(read < contentLength){
// Read next lot
if((bytes = recvTcp(link,buffer,CBUFF_HUGE)) <= 0){
switch(bytes){
// Remote closure
case 0:
return true;
// Error - check
default:
switch(OSALASTERROR){
// No data to read - try again
case OSAWOULDBLOCK:
if(!waitForEvent(link,2000))
return false;
continue;
// Oh oh
default:
return false;
}
break;
}
}
buffer[bytes] = 0;
read+=bytes;
content.strcat(buffer);
//.........这里部分代码省略.........