why does they use this kind of scanf..

This is a discussion on why does they use this kind of scanf.. within the C Programming forums, part of the General Programming Boards category; i was told that the feilds are not separated (in each line the feilds are sticked together) why they say ...

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    why does they use this kind of scanf..

    i was told that the feilds are not separated (in each line the feilds are sticked together)

    why they say fscanf(file,"%29[^$]%10 ...

    why not just fscanf(file,"%29%10 ...

    why they say (or till char '$')
    ??

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,795
    Who are they and what do they want to do?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    people who wrote a solution to that question
    they say read 29 chars or till char $
    why not just "read 29 chars"

    the feild are sticked together
    ??

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,795
    Quote Originally Posted by transgalactic2
    people who wrote a solution to that question
    They are wrong. The answer is 42.

    So, what's the question?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm pretty sure that $ has a special meaning (in fact, I'd be very surprised if $ doesn't mean end of line).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf skips lines of code in DOS using Dev-C++ and Windows XP
    By jenovanomusuko in forum C Programming
    Replies: 9
    Last Post: 12-21-2008, 02:10 AM
  2. scanf - strtok and space as delimiter?
    By Bill Cosby in forum C Programming
    Replies: 6
    Last Post: 09-20-2004, 06:45 PM
  3. First scanf() skips next scanf() !
    By grahampatten in forum C Programming
    Replies: 5
    Last Post: 08-17-2004, 02:47 AM
  4. nested if-else forgot how to clear scanf
    By ronin in forum C Programming
    Replies: 4
    Last Post: 06-25-2002, 09:53 PM
  5. weird scanf()
    By trekker in forum C Programming
    Replies: 1
    Last Post: 06-24-2002, 08:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21