I'm trying to convert this string "09195462965"
to an int but I'm running into problems.
snippet of my code:
int n, p, pnum=0;
char buffer[256];
char *endptr;
long pnumber;
bzero(buffer,256);
p = read(sock,buffer,255);
pnumber = strtol(buffer, &endptr, pnum);
printf("n: %ld",pnumber);
p = write(sock,buffer,sizeof(buffer));
A client sends a string of "09195462965"
then the server receives it.
Now on the server that string must be turned into an int
i.e. 09195462965
.
Note: the server sends the number as string.