K
Kifah Abbad
Ok guys,
here is the deal, i hope someone can help me out with this.
I receive a string through a socket...i dunno how long this string is,
but i save it all into a buf.
..
..
..
now i know what the first 10 chars of the string in buf is, and i copy
it into another variable
..
..
..
Now...how can i save the rest (what comes after the first 10 chars)
into a seocd variable?
here is the deal, i hope someone can help me out with this.
I receive a string through a socket...i dunno how long this string is,
but i save it all into a buf.
..
..
..
Code:
if (!fork()) { // this is the child process
close(sockfd); // child doesn't need the listener
if ((numbytes=recv(new_fd, buf, MAXDATASIZE-1, 0)) == -1) {
perror("recv");
exit(1);
}
buf[numbytes] = '\0';
printf("Received: %s\n",buf);
now i know what the first 10 chars of the string in buf is, and i copy
it into another variable
..
..
..
Code:
//extract clearance and copy it into extract_clearance
strncpy(extract_clearance,buf,10);
//printf("clearnace: %s\n",extract_clearance);
Now...how can i save the rest (what comes after the first 10 chars)
into a seocd variable?