glinsvad
January 25th, 2006, 06:10 PM
Hi
I'm building my own class for string manupulations in C/C++ to refresh my programming skills a little (let's just say I used Win98 the last time I compiled anything :).
Basically I want to create my own sprintf, so I need to figure out how one declares a function that can accept ANY number of arguments of ANY type char/char*/int/float etc. Naturally function overloading is out of the question:
char* sprintf(char*,char);
char* sprintf(char*,char*);
char* sprintf(char*,int);
char* sprintf(char*,float);
char* sprintf(char*,char,char);
char* sprintf(char*,char,char*);
...
If I don't want to cast the information into a list of strings (char** like in main-funtion) before calling my sprintf, how can it be done? Or can't it?
Cheers
I'm building my own class for string manupulations in C/C++ to refresh my programming skills a little (let's just say I used Win98 the last time I compiled anything :).
Basically I want to create my own sprintf, so I need to figure out how one declares a function that can accept ANY number of arguments of ANY type char/char*/int/float etc. Naturally function overloading is out of the question:
char* sprintf(char*,char);
char* sprintf(char*,char*);
char* sprintf(char*,int);
char* sprintf(char*,float);
char* sprintf(char*,char,char);
char* sprintf(char*,char,char*);
...
If I don't want to cast the information into a list of strings (char** like in main-funtion) before calling my sprintf, how can it be done? Or can't it?
Cheers