Hope this isn't a stupid question, but Im trying to make a proper wrapper for printf.
I get the proper output doing the following:
The output is:Code:text.hprintf("test\n");
But I get a wierd output if I do:Code:test
The output is:Code:text.hprintf("test\n%i", 123456789);
Here's the small source.Code:test
1244892
main.cpp
output.hCode://Alot of these includes are not used.
//Most will be used in the future.
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <fstream>
#include <windows.h>
#include <cstring>
#include <time.h>
#include "output.h"
CTextOutput text;
int main(){
char omfg;
int i = 0;
while(1){
if(i==0)
text.hprintf("test\n%i", 123456789);
std::cin>>omfg;
i=1;
}
return 0;
}
output.cppCode:#ifndef OUTPUT_H
#define OUTPUT_H
class CTextOutput
{
private:
public:
int hprintf(const char* string, ...);
int haprintf(const char* string, ...);
};
#endif
This was my attempt at a custom wrapper. Any ideas?Code:#include <cstdlib>
#include <iostream>
#include <fstream>
#include <windows.h>
#include <string>
#include <cstring>
#include <time.h>
#include "output.h"
int CTextOutput::hprintf(const char* string, ...)
{
printf(string);
return 0;
}
int CTextOutput::haprintf(const char* string, ...)
{
printf("<<: ");
printf(string);
return 0;
}