I'm currently learning the network programming with C/C++... I have experience .NET but not in C (esp: in Unix network programming)
The problem that I'm facing right now is that when I receive the message, I like to split it into two parts. The format of message will be like [command] filepath
(For example: get a.txt
or put a.txt
)
I'm using recvform to receive the message.
int recvfrom(int sockfd, void *buf, int len, unsigned int flags,
struct sockaddr *from, int *fromlen);
The problem is that I dont know how to convert "void *buff" into string so that I can do String.Split(" ") to get the command and file name.
Could anyone please explain me a way to convert "void *buff" to string?