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:
Code:
text.hprintf("test\n");
The output is:
But I get a wierd output if I do:
Code:
text.hprintf("test\n%i", 123456789);
The output is:
Here's the small source.
main.cpp
Code:
//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.h
Code:
#ifndef OUTPUT_H
#define OUTPUT_H
class CTextOutput
{
private:
public:
int hprintf(const char* string, ...);
int haprintf(const char* string, ...);
};
#endif
output.cpp
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;
}
This was my attempt at a custom wrapper. Any ideas?