这是我的代码
CInternetSession session(L"My Session");
CHttpConnection *pHttpCon ;
CHttpFile *filedat = NULL;
pHttpCon = session.GetHttpConnection((LPCTSTR)Url_server, (INTERNET_PORT)1040, (LPCTSTR)username, (LPCTSTR)password);
filedat = pHttpCon->OpenRequest(CHttpConnection::HTTP_VERB_GET, "");
filedat->SendRequest();
CString line;
while(filedat->ReadString(line)) {
printf("Line : %s ",(LPCTSTR)line);
printf("\n Line Length : %d ",line.GetLength());
}
问题是String Read是“file1.name = 201304”,长度是9 它应该是17或更多。任何好友能告诉我可能是什么问题吗?
String Read Showing Length
"file1.size=16" 7
"file1.time=2013/02/28 Thu 10:36:32" 17
"file1.name=201304" 9
答案 0 :(得分:0)
以下是否有效:
while(filedat->ReadString(line))
{
/* Original code
printf("Line : %s ",(LPCTSTR)line);
printf("\n Line Length : %d ",line.GetLength());
*/
_tprintf(L"%s\n", (LPCTSTR)line);
_tprintf(L"Line Length: %d\n\n", line.GetLength());
}