Variable number of arguments in function.

This is a discussion on Variable number of arguments in function. within the C Programming forums, part of the General Programming Boards category; How to start with my own formating function? I never wrote any with variable number of arguments. How to do ...

  1. #1
    Wymiatacz
    Join Date
    Jan 2007
    Location
    Far away
    Posts
    6

    Cool Variable number of arguments in function.

    How to start with my own formating function? I never wrote any with variable number of arguments. How to do it?

    In my case declaration looks like that:
    Code:
    int dprintf(char *str, const char *format, ...)
    But what next, how to handle 1st 2nd or 5th argument??? I would be grateful for printf() function body also.
    Better is an enemy of good ...

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    search va_start on the forum and inet

    http://c-faq.com/varargs/varargs1.html
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 06:18 AM
  2. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 07:55 AM
  3. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM

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