Hello I am having trouble with a function that receives a string from a client in the format "number op number" ,op being a (+,-.*,/), then returns an answer to the client. I need help splitting the string into two num variables and one op variable.
Here is the function in question.
void func(int sockfd)
{
char buff[MAX];
int n, i, size, j;
while (1) {
bzero(buff, MAX);
// read the message from client and copy it in buffer
read(sockfd, buff, sizeof(buff));
long int num1, num2, op;
char temp[256];
strcpy(temp, buff);
sscanf(buff, "%s %s %s", num1, op, num2);
// print buffer which contains the client contents
printf("From client: %ld | | %ld", num1, num2);