1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is this true about 'printf' and 'scanf'?

Discussion in 'C' started by inspiration, Apr 16, 2010.

  1. inspiration

    inspiration New Member

    Joined:
    Feb 15, 2010
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    0
    I read somewhere that printf and scanf had "advanced features" and they
    point to:

    scanf("%[^\n]",line); // line is a string

    as an example, where scanf() acts like gets()

    I try to look of more of this "advanced features" in documentation but
    couldn't found any. What "advance features" do you of these functions
    (printf and scanf)?
     
  2. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0

    Think of what happens when there's more charaters in the input buffer
    than you allowed for in your string buffer.

    You're better off using `fgets()` and `sscanf()`.



    In my line of work, exactly none (don't even use the functions, let
    alone their "advanced" features).
     

Share This Page