Thread: Return values

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    38

    Return values

    There will be some library function whose return values are hardly taken care. Best example would be printf.
    During programming, we never catch its return value.

    Similar to printf, can I ignore sscanf function return value?

    Please advise.

    Juganoo

  2. #2
    Registered User FCF's Avatar
    Join Date
    Dec 2001
    Posts
    40
    Hi,

    >If n == 1, then you should not then go and use the result in b, because nothing will be there.

    Not sure, but i think...
    n == 1, so we assume a is converted, and b encounterd problem. How abt a encoutered problem first, b is converted? Will n still be 1? If yes, we can only test for n==0 for any error or n==2 for success.
    Life is difficult...

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >How abt a encoutered problem first, b is converted?
    This won't happen, if the conversion for a cannot be completed then sscanf returns EOF because an error occured before any conversions were made. Both a and b will remain indeterminate.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  3. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 01:54 AM