CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Possible to define a var. arg. function in CCS C?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
blak3r



Joined: 11 Jan 2004
Posts: 45

View user's profile Send private message Visit poster's website

Possible to define a var. arg. function in CCS C?
PostPosted: Fri Jun 02, 2006 12:33 pm     Reply with quote

Code:
     

#include <stdio.h>
#include <stdarg.h>

int debug( const char* str, ...)
{
    if( DEBUG_LOG ) {
       va_list ap;           
        va_start(ap, s);         
        printf("DEBUG: ");         
   vprintf(s, ap);           
   putchar('\n');             
   va_end(ap);     
    }              
}


The code above uses vprintf c libraries to pop the variable arguments off the stack and then print them out. I couldn't find anything similiar in manual or anyone else mentioning it on the forums. Is there anyway to create a function which can take a variable number of arguments in CCS-C?

Thanks,
Blake Robertson
_________________
"Everything should be made as simple as possible, but not one bit simpler" -- Albert Einstein

http://www.blakerobertson.com
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 02, 2006 1:15 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=24802
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group