hotadvice said:
Please place your reply *after* the text you are replying to, it makes
it far easier to read.
A: because you have to keep scrolling up and down
Q: what is one reason why top posting is harder to read?
One can use strtok() here.
Yes, provided one knows the caveats.
here all tokens are seperated by whitespace (and assuming any token
does not contain a whitespace character).
char *tok;
char* buff= readLine(...); /* read in a line in buffer say
"1 flatt xxx.xxx.xxx.xxx 5000" */
tok=strtok(buff,"\t "); /* token one ie "1" */
while(tok)
{
tok=strtok(NULL,"\t ");/*
token two ie "xxx.xxx.xxx.xxx" and so
on.
stop when it returns NULL.
*/
}
read about strtok() // its a standard function
strtok has problems that the OP needs to watch out for. It maintains
state internally, so you can't interleave two sets of passing using
strtok, which can happen by mistake if it is called from within a
function. strtok merges delimiters, which in this case is probably not a
problem.