OK last question:

Code:
   		unsigned int j = 0;
		do { 
			if (recv(h,&buf[j],1,0)==SOCKET_ERROR) {
				addlog("retlinehttp(): recv() Failed! %d", WSAGetLastError());
				return -2;
			}
			if (data = strstr(buf, "\r\n\r\n")) {
				data2 = strstr(buf, "Content-Length:");
				data2+=15;
				break;
			}
			//fwrite (&buf[j] , 1 , 1 , file);
			j++;
		} while (j < sizeof(buf));
		buf[j-1]='\0';
		
		int size = atoi(data2);

		char* buffer;
		buffer = new char[size];

   		unsigned int k = 0;
		do { 
			if (recv(h,&buffer[k],1,0)==SOCKET_ERROR) {
				addlog("retlinehttp(): recv() Failed! %d", WSAGetLastError());
				return -2;
			}
			fwrite (&buffer[k] , 1 , 1 , file);
			k++;
		} while (k < sizeof(buffer));
At this point somthing went wrong buffer = new char[size];
Lets say I download a file then I get back the information Content-Length: 24576 this value I have as a char and the pointer data2 points to it. Then I convert the char into int. Now the value is in size. But when I try to create a new buffer, the buffer is not big as size, but has a sizeof 4?
Whats wrong?