this function in my TCP/IP wrapper class reads from the socket into the char pointer bufm byte at a time until it reads the string "end". I can verify that it actually does this using printf right before the return 0...
but when i call this functon from main:
int TcpIp::readUntil(char *buf, int bufsiz, char *end)
int br = 0;
tbuf = '\0';
buf = '\0';
while (recv(connection, tbuf, 1, 0) != SOCKET_ERROR)
if (br == bufsiz)
the buffer is filled with garbage, even if the function itself proves the pointer has the received string in it.
if (!connection.readUntil(buffer, 256, "\n\n"))
cout << buffer;