i am making my own c (no c++ material so that it can work with any c-based language) header file and the next thing i want to make for it is an output stream function. i cant find a tutorial online. so if someone could either point me in the right direction or explain to me how to do it, that would be extremely helpful. also im not looking for source code unless its to check my work against.
no like int printf(char *fmt, ...)
i already can print variables and strings and have variable list arguements, but i cant find a way to print to the screen w/o printf
> because i want to make my own, for the practice and experience.
With the advent of variadic templates, the practice and experience gained in using <cstdarg> would be quite irrelevant to real-life C++ code. The rest of it would still be a good beginner's exercise.
Start with something extremely minimal.
For instance this (just bare %d, %f, %s, %p and nothing else, and no error handling):
1 2 3 4 5 6
// header
#ifdef __cplusplus
extern"C"
#endif
int minimalist_printf( constchar* format, ... ) ;