-2

这是我的代码

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());
}

问题是字符串读取是“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
4

1 回答 1

0

Does the following work:

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());
}
于 2013-04-16T20:17:55.247 回答