Fedora Linux Support Community & Resources Center
  #1  
Old 22nd July 2010, 09:37 PM
merkava's Avatar
merkava Offline
Registered User
 
Join Date: Jul 2010
Location: Tabriz, Iran
Age: 23
Posts: 75
windows_xp_2003firefox
Variable-length Argument Lists in C

Hi guys.
When we want to use variable-length argument lists we use these three functions:
va_start()
va_arg()
va_end()
I didn't list the arguments.

But how do we know that the one returned by va_arg() is the last one? if we don't want to implement Variable-length arguments like printf() or scanf().
__________________
Best Regards
MERKAVA
Reply With Quote
  #2  
Old 25th July 2010, 09:11 AM
RaBones Offline
Registered User
 
Join Date: Jul 2010
Posts: 1
linuxfedorafirefox
Re: Variable-length Argument Lists in C

As I recall, va_arg yields NULL when you try to get passed the final argument.

char *arg;
while ((arg = va_arg()) != NULL) {
...

It's been a while, but that seems about right.

Oh, now I remember. I always passed a list of arguments in the function call ending with NULL.

myfunc (arg1, arg2, arg3, NULL);

So I would know.

Last edited by RaBones; 25th July 2010 at 09:17 AM.
Reply With Quote
  #3  
Old 25th July 2010, 07:04 PM
merkava's Avatar
merkava Offline
Registered User
 
Join Date: Jul 2010
Location: Tabriz, Iran
Age: 23
Posts: 75
windows_xp_2003firefox
Re: Variable-length Argument Lists in C

Thank you very much.
__________________
Best Regards
MERKAVA
Reply With Quote
Reply

Tags
argument, lists, variablelength

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Length miker24 Security and Privacy 1 3rd December 2009 06:10 PM
iperf generating variable length packet at each interval rohit83.ken Servers & Networking 0 9th March 2009 04:07 PM
Is there any way to lessen password length? neo_in_matrix Security and Privacy 6 29th November 2008 10:16 AM
Invalid PBLK Length Marada Using Fedora 2 12th July 2007 02:12 PM
SSH Key Length OMF Security and Privacy 1 14th October 2005 12:47 AM


Current GMT-time: 23:03 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat