How do you get pub.freeprocess to read i/o ??

BlitzMax Forums/BlitzMax Programming/How do you get pub.freeprocess to read i/o ??

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Your example now works.

Now try this:
SuperStrict

Framework brl.standardio
Import pub.freeprocess

?Win32

	'Lets use OO for the hell of it, although you can use CreateProcess() if you prefer
	'There is only 1 flag available - HIDECONSOLE that is supposed to hide console output ;-) but it doesn't make much difference either way on my Windows machine
	Local temp_process:TProcess = TProcess.Create("net start THIS_SERVICE_DOESNT_EXIST",HIDECONSOLE)
	
	Print ""
	Print "IPConfig Status: " + temp_process.Status()	'Show that the program is running
	Print "================================"
	
	While temp_process.Status()	'Checks to see if the process is still running
		
		'Temp variable that stores output from the pipe before it is converted to a string
		Local tmpBytes:Byte[]
		'Check if the pipe contains any data that hasn't been read and if so, load data into variable array, and convert array to string
		If temp_process.pipe.ReadAvail() Then tmpBytes = temp_process.pipe.ReadPipe();Print String.FromBytes( Varptr tmpBytes[0], tmpBytes.length )
		
	Wend
	

		
	'Terminate process manually (the fact that is has escaped the above loop means it has already closed but put it in as an example)
	temp_process.Close()
	'This is a quick way you can terminate all processes without bothering to loop through them all (again not needed)
	TProcess.TerminateAll()
	
	Print "================================"
	Print "IPConfig Status: " + temp_process.Status()	'Show that the program has ended
	Print ""

?MacOs

	Print "Mac OS X doesn't have IpConfig."

?Linux

	Print "Linux doesn't have IpConfig."

?


Why does this not work ???