Date: Mon, 2 May 2011 15:20:54 +0100 From: Rob <robpilling@gmail.com> To: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf Message-ID: <BANLkTikm6CJ_Sc8NaQwhjguUQ7=O5OV%2BxA@mail.gmail.com> In-Reply-To: <BANLkTim_WhRdWi8RbuubxQm4kD27V17h9g@mail.gmail.com> References: <C9E46C77.389%moeller.akt@googlemail.com> <4DBEAAD5.7040906@bytecamp.net> <BANLkTim_WhRdWi8RbuubxQm4kD27V17h9g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTikm6CJ_Sc8NaQwhjguUQ7=O5OV%2BxA>