Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (TipmyPip, clint000, Grant), 6,810 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Console Output? [Re: Germanunkol] #345282
10/24/10 18:33
10/24/10 18:33
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Germanunkol
I guess I'll have to make input work as well somehow, that'll be harder...

Not really, you can use stdin to fetch input from the user.
A way to make it easier than just dumb listening to the file stream would be something like fscanf() that does this automatically for you.

Last edited by JustSid; 10/24/10 18:44. Reason: Forgot an f... shame on me

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Console Output? [Re: Germanunkol] #345299
10/24/10 21:44
10/24/10 21:44
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Originally Posted By: Germanunkol
Yes, guess why I couldn't get it to work? grin

STRINGS seem to mess up, but that makes sense I guess, since they're acknex-structs...

Oh well. It works now. I guess I'll have to make input work as well somehow, that'll be harder...


STRING* strTest = str_create("Hello Acknex");

char* cTest = strTest->chars; //pass to console

This should work.

Re: Console Output? [Re: FBL] #345326
10/25/10 12:09
10/25/10 12:09
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
or _chr(STRING);


~"I never let school interfere with my education"~
-Mark Twain
Re: Console Output? [Re: Germanunkol] #345414
10/25/10 23:55
10/25/10 23:55
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
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
Page 3 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1