January 1, 2005

WinTask - Space$

'
' Space$() - return a string with nn spaces
'

' Author: Joe Strazzere

'

 

Dim spaceptr as unsigned

 

Function Space$(nn)
    spaceptr=allocate(nn)
    External("user32.dll", "wsprintfA", spaceptr, "%"+str$(nn)+"s", "")
    Space$=peekstring$(spaceptr)
EndFunction

 

a$=Space$(123)

 

'msgbox("Length of resulting string is "+str$(Len(a$)),,"Space$")
msgbox("["+a$+"]",,"Space$")