Print without starting a new line?

BlitzMax Forums/BlitzMax Programming/Print without starting a new line?

JoshK(Posted 2007) [#1]
I'd like to print a line of periods to indicate a console app is processing, without starting a new line. Is this possible?


GW(Posted 2007) [#2]
For I = 0 To 100
StandardIOStream.WriteString "."
StandardIOStream.Flush '<-- not sure if this is required
Delay(100)
Next


Azathoth(Posted 2007) [#3]
You could try using StandardIOStream.WriteString


Vertex(Posted 2007) [#4]
or
WriteStdOut("A")
WriteStdOut("B")
WriteStdOut("C~n")
WriteStdOut("I'am a new Line")
->
ABC
I'am a new Line


Chroma(Posted 2007) [#5]
ziggy = teh winner.

Yes, I'm psychic.


GW(Posted 2007) [#6]
my solution has more letters.
GW <- WINNER! :)


ziggy(Posted 2007) [#7]
@Leadwerks and Vertex: WriteStdOut will not take in consideration the 'endianess' of the platform, it will make a direct string to byte conversion.
StandardIOStream works as spected with all spetial and non spetial characters, using unicode encoding, the same as Print. So I would suggest to use the GW solution. Additionally, the flush command should be called to ensure your application doesn't write more than 4096 bytes to the standard output pipe, or it will get filled if the calling application is not freeing it fast, and both applications (console and yours) could hang. Believe me, this can be potentially a very big problem I used to get with the BlitzMax built in debuger.

My Advise:
Function PrintString(S:String, EndLine:Int = True) 
	StandardIOStream.WriteString(S) 
	If endLine Then StandardIOStream.WriteString("~n") 
	StandardIOStream.Flush() 
End Function

PrintString("Hello") 
PrintString("Your name is ", False)   'This will not end the current console line
PrintString("Michael") 


Hope it helps