Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char buffer[512] = "GET /testfile.htm HTTP/1.0";
- char* filename; // I want *filename to hold only "/testfile.htm"
- msgLen = recv(connecting_socket, buffer, 512, 0);
- strncpy(filename, buffer+5, msgLen-9);
- strncpy(filename, buffer+5, msgLen-9);
- char filename[512];
- char buffer[512] = "GET /testfile.htm HTTP/1.0";
- char filename[512]; // I want *filename to hold only "/testfile.htm"
- msgLen = recv(connecting_socket, buffer, 512, 0);
- strncpy(filename, buffer+4, msgLen-4-9);
- //the first parameter should be buffer+4, not 5. Indexes are zero based.
- //the second parameter is count, not the end pointer. You should subtract
- //the first 4 chars too.
- filename[msgLen-4-9] = 0;
- memcpy(filename, buffer+4, msgLen-4-9);
- fileName[msgLen-4-9] = 0;
- char* filename;
- char filename[SOME_BUFFER_SIZE];
- char filename[512]
- filename = (char *)malloc(msgLen - 9 - 6 + 1 ); /* + 1 for the terminating null */
- filename = (char*)malloc(512*sizeof(char));
Add Comment
Please, Sign In to add comment