[LIBC] Modfied Version of sscanf
Rob
robpilling at gmail.com
Mon May 2 14:43:37 UTC 2011
For goodness sake, it's not even NP-complete.
char *start = strchr(line, ' ') + 1; char *end = strrchr(line, ' ');
char *ret;
*end = '\0';
ret = strdup(start);
*end = ' ';
return ret;
Obviously there's no error checking, but there you go. I don't see
what's inelegant about that.
This is C, use pointers, if you want high level string parsers, use
Perl.
Cheers,
Rob.
More information about the freebsd-hackers
mailing list