This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

format specifier %[blah] for fscanf


HI there GCC Gurus,

I am hoping that this is an appropriate place to ask this question.

please reply directly to this email, as I am not a member of the list.

I have been fighting with using the above format modifier, without
any success (using glibc2-12 on redhat 7, with GCC 2.96-85)...
(code as an example)
_________________________________________________

#include <stdio.h>

main() {
    FILE *jock;
    char jk[26];
    jock = fopen("craper", "r");
    fscanf(jock, "%25s", jk);
    printf("%s\n", jk);
    fscanf(jock, "%25[a-z]", jk);
    printf("%s\n", jk);
    fclose(jock);
}
______________________________________________________
The first fscanf works fine, but the second does not return anything
 sensible. Is the %[blah] modifier supposed to work?  The code compiles but
 does not behave as expected.  The info files describe the modifier as 
I have used it above...but it does not appear to work.

Am I just an idiot, and am using the format modifier incorrectly, or is there
something missing from the library here?

Any help appreciated,
thanks,

Matt



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]