while( fscanf( tracefile, "%s ", opcode ) != EOF ){blah}
Occasionally I need to cause fscanf to re-read a line upon a certain condition in my code being met. Is this possible; ...
I'm attempting to read a file (particularly /proc/stat) to get data out of it. There are a multitude of ways to do this in C, but (so far) I'm using fscanf(). ...
Then just put a * before the d in the fscanf() line, and that should work. I haven't done that, however. What I do is scan the item in and assign it to "gar" (short for garbage), and then just ignore it. Gar gets re-used for different items like that. But don't Rube Goldberg the whole fscanf() stuff with multiple lines ...
I'm using an ANSI C program to read in data from a file that has, every few lines, a name on it. Sometimes the name is just a first name, as in "Dave", and sometimes it's two names, as in "Bob Jones". I need to store the name in a string, and I need all of it (not just the first ...
Quote: Originally posted by Scorpions4ever %[^/] means match all characters from the input which are not '/' (basically keep reading chars until you hit a '/') . * means read the next input and then discard the value (i.e. do not assign it to any variable in the argument list). So %*c means, read one character and then ignore the value ...