Is there a clean, preferably standard method of trimming leading and trailing whitespace from a string in C? I\'d roll my own, but I would think this is a common problem wit
Another one, with one line doing the real job:
#include int main() { const char *target = " haha "; char buf[256]; sscanf(target, "%s", buf); // Trimming on both sides occurs here printf("<%s>\n", buf); }