I have this code, and I have this problems: Error 1 error C2110: '+' : cannot add two pointers 2 IntelliSense: expression must have integral or unscoped enum type
I am trying to GET data to the test.php file, with the m_AccountID variable data, I tryed many things, but I got this two errors.
Any idea to fix it?:)
void ConnectEx::SendDataPHP(){
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
//cout << "WSAStartup failed.\n";
//system("pause");
return;
}
SOCKET Socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct hostent *host;
host = gethostbyname("www.mysite.com");
SOCKADDR_IN SockAddr;
SockAddr.sin_port = htons(80);
SockAddr.sin_family = AF_INET;
SockAddr.sin_addr.s_addr = *((unsigned long*)host->h_addr);
//cout << "Connecting...\n";
if (connect(Socket, (SOCKADDR*)(&SockAddr), sizeof(SockAddr)) != 0){
//cout << "Could not connect";
//system("pause");
return;
}
//cout << "Connected.\n";
send(Socket, "GET /api/test.php?username=" +m_AccountID+ "HTTP/1.1\r\nHost: www.mysite.com\r\nConnection: close\r\n\r\n", strlen("GET /api/test.php?username="+m_AccountID+ "HTTP/1.1\r\nHost: www.mysite.com\r\nConnection: close\r\n\r\n"), 0);
char buffer[10000];
int nDataLength;
while ((nDataLength = recv(Socket, buffer, 10000, 0)) > 0){
int i = 0;
while (buffer[i] >= 32 || buffer[i] == '\n' || buffer[i] == '\r') {
//cout << buffer[i];
i += 1;
}
}
closesocket(Socket);
WSACleanup();
//system("pause");
return;
}
class ConnectEx
{
public:
void SendDataPHP();
.
.
.
.
char m_AccountID[11];
.
.
.
}; extern ConnectEx gConnectEx;
char m_AccountID[11];tostd::string m_AccountID;std::string( "GET /api/test.php?username=" + m_AccountID + " HTTP/1.1\r\nHost: www.mysite.com\r\nConnection: close\r\n\r\n" ).c_str( )but only for the first part