Skip to content

Instantly share code, notes, and snippets.

@richo
Created January 24, 2013 04:47
Show Gist options
  • Save richo/4617723 to your computer and use it in GitHub Desktop.
Save richo/4617723 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char* buf;
asprintf(&buf, "%s", ", this is some butts, ");
char* end = &buf[sizeof(char) * strlen(buf) -1];
while (*end == ' ' || *end == ',') {
*end = '\0';
end--;
}
printf("%s\n", buf);
free(buf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment