See also: Is this a good substr() for C?
strtok() and friends skip over empty fields, and I do not know how to tell it not to skip but rather return e
strtok()
On some system, there is a function called strsep(). And you can find its source code by google. For example, http://www.google.com/codesearch/p?hl=zh-TW#XAzRy8oK4zA/libc/string/strsep.c&q=strsep