Автор: cheops (29.01.2007 в 20:15)
Вот небольшой пример
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char buff[20*1024];
string str = "";
buff[0] = '1';
buff[1] = '\0';
str.append(buff);
buff[0] = '2';
buff[1] = '\0';
str.append(buff);
cout << str << endl;
return 0;
} |
Т.е. ваш блок может выглядеть так
char buff[20*1024];
string str = "";
while( bytes_recv = recv(my_sock,(char*) &buff,sizeof(buff),0))
{
str.append(buff);
} |