Just tried to get a handle to the original printf function, but something doesn't want me to get it running.
I've created a small demo with pure Windows API functions that shows how to write/read from the console:
Code:
#include <acknex.h>
#include <windows.h>
#include <stdio.h>

// We need those headers
BOOL WINAPI WriteConsole(
	HANDLE hConsoleOutput,
	const void *lpBuffer,
	DWORD nNumberOfCharsToWrite,
	DWORD *lpNumberOfCharsWritten,
	void *lpReserved);
	
BOOL WINAPI ReadConsole(
	HANDLE  hConsoleInput,
	void *lpBuffer,
	DWORD  nNumberOfCharsToRead,
	DWORD *lpNumberOfCharsRead,
	void *pInputControl);

function main()
{
	// Create console window
	AllocConsole();
	
	// Get handles to the input and output console
	HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);
	HANDLE input = GetStdHandle(STD_INPUT_HANDLE);
	
	// Write some text
	WriteConsole(output, "Hello World!", 12, NULL, NULL);
	
	// Read some text (one line to be exact)
	char buffer[128];
	DWORD len;
	ReadConsole(input, buffer, 127, len, NULL);
	buffer[len] = 0;
	
	// Echo result
	error(buffer);
}



Visit my site: www.masterq32.de