What is the function of "%[^\n]" in a scanf?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kamalesh kumar

    What is the function of "%[^\n]" in a scanf?

    this is the statement i encountered . . .

    Code:
    fscanf(fp,"%[^\n]",str1);
    where str1 is a str1[80]

    can someone please unconfuse me on whats the difference between using a %c and a %[6\n] in reading strings ? thanks
    Last edited by Dormilich; Oct 20 '10, 11:49 AM. Reason: please use [code] [/code] tags when posting code
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    This one scans tabs and spaces - see http://linux.die.net/man/3/scanf

    Comment

    Working...