Skip to content

Instantly share code, notes, and snippets.

@Wollw
Created February 23, 2012 05:17
Show Gist options
  • Save Wollw/1890495 to your computer and use it in GitHub Desktop.
Save Wollw/1890495 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
char s1[256],s2[256],s3[256];
int i;
sscanf("MPTRAY=FIRST [3 ENUMERATED READONLY]",
" %s [%d %s %s]",
s1, &i, s2, s3);
s3[strlen(s3) - 1] = '\0';
printf("%s\n%d\n%s\n%s\n", s1, i, s2, s3);
}
/*
~$ ./a.out
MPTRAY=FIRST
3
ENUMERATED
READONLY
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment