Name: Anonymous 2013-01-31 15:36
Write a program that displays "Hello world" (without quotes) to the screen.
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <stdarg.h>
using namespace std;
class ByteClass
{
public
ByteClass(unsigned int len, ...);
~ByteClass();
char * ConvertByteClassBytesToChars(int len);
unsigned int * bytes;
}
ByteClass::~ByteClass()
{
;
}
ByteClass::ByteClass(unsigned int len, ...)
{
bytes = (unsigned int *)malloc(len * sizeof(unsigned int *) + 1);
va_list ap;
va_start(ap, len); // ???
for(int i = 0; i <= len - 1; i++)
{
bytes[i] = (char) va_arg(ap, unsigned int); //???
}
va_end(ap);
}
char * ByteClass::ConvertByteClassBytesToChars(int len)
{
char * chars = (char *)malloc(4294967296 * sizeof(char*) + 1);
for (int i = 0; i <= len - 1; i++)
{
chars[i] = (char) bytes[i];
}
return chars;
}
class PrintClass
{
public:
PrintClass();
~PrintClass();
char * strPrint;
}
PrintClass::~PrintClass()
{
; // so it does nothing. Thanks Tim!
}
// string must never be longer than 2^32!
PrintClass::PrintClass(char * argument)
{
strPrint = (char *)malloc(4294967296 * sizeof(char*) + 1); //large enough for any usage :)
//now to store the string for printing
strPrint = &argument; // points at to argument
cout << strPrint; // print
}
int main()
{
ByteClass b = new ByteClass(0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00);
PrintClass * d = new PrintClass(ConvertByteClassBytesToChars(1000));
return 0;
}