Try this example, already converted from here.

Code:
#include <acknex.h>
#include <windows.h>
#include <stdio.h>

#define BUFSIZE 4096

typedef char CHAR;

CHAR chBuf[BUFSIZE];
DWORD dwRead, dwWritten;
HANDLE hStdin, hStdout;
BOOL bSuccess;

void logToConsole(STRING* logStr) {	
	WriteFile(hStdout, logStr, str_len(logStr), &dwWritten, NULL);
	WriteFile(hStdout, "\n", 1, &dwWritten, NULL);
}

void main() {
	video_screen = 0;
	AllocConsole();
	SetConsoleTitle("CSiS Dedicated Server");
	
	hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
	hStdin  = GetStdHandle(STD_INPUT_HANDLE);
	
	logToConsole("CSiS Dedicated Server");
	
	if ( (hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) ) ExitProcess(1);
	
	// Send something to this process's stdout using printf.
	
	//printf("\n ** This is a message from the child process. ** \n"); 
	
	// This simple algorithm uses the existence of the pipes to control execution.
	// It relies on the pipe buffers to ensure that no data is lost.
	// Larger applications would use more advanced process control.
	
	for (;;) {
		
		// Read from standard input and stop on error or no data.
		bSuccess = ReadFile(hStdin, chBuf, BUFSIZE, &dwRead, NULL); 
		
		if (! bSuccess || dwRead == 0) break; 
		
		// Write to standard output and stop on error.
		bSuccess = WriteFile(hStdout, chBuf, dwRead, &dwWritten, NULL); 
		
		if (! bSuccess) break; 
	}
	return 0;
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P