void TrimTrailingSpace(char *s) { for (char *p = &s[strlen(s)-1]; p >= s; p--) { if (!isspace(*p)) break; *p = '\0'; } }
void ExampleUse() { char buf[100]; lstrcpyn(buf, "Hello World ", sizeof(buf)); TrimTrailingSpace(buf); printf(">%s<\n", buf); // Will output >Hello World< }