I have run into some code and was wondering what the original developer was up to. Per the norm I have simplified it down to the basic case before asking your assistance. The man page for scanf has relevant information. I am having some trouble reading it.
#include <stdio.h>
int main() {
char title[80] = "mytitle";
char title2[80] = "mayataiatale";
char mystring[80];
/* hugh ? */
sscanf(title,"%[^a]",mystring);
printf("%s\n",mystring); /* Output is "mytitle" */
/* hugh ? */
sscanf(title2,"%[^a]",mystring); /* Output is "m" */
printf("%s\n",mystring);
return 0;
}
I hoping for an anectodal usage and reasons code like this might be used. The code is part of a larger code generated application. I appreciate any feedback.