40 lines
898 B
Plaintext
40 lines
898 B
Plaintext
' version 15-09-2015
|
|
' compile with: fbc -s console
|
|
|
|
Sub printAll_string Cdecl (count As Integer, ... )
|
|
Dim arg As Any Ptr
|
|
Dim i As Integer
|
|
|
|
arg = va_first()
|
|
For i = 1 To count
|
|
Print *Va_Arg(arg, ZString Ptr)
|
|
arg = va_next(arg, ZString Ptr)
|
|
Next i
|
|
End Sub
|
|
|
|
' ------=< MAIN >=------
|
|
' direct
|
|
printAll_string (5, "Foxtrot", "Romeo", "Echo", "Echo", "BASIC")
|
|
|
|
' strings
|
|
Print : Print
|
|
Dim As String a = "one", b = "two", c = "three"
|
|
printAll_string (3, a, b, c)
|
|
|
|
' count is smaller then the number of arguments, no problem
|
|
Print : Print
|
|
printAll_string (1, a, b, c)
|
|
|
|
' count is greater then the number of arguments
|
|
' after the last valid argument garbage is displayed
|
|
' should be avoided, could lead to disaster
|
|
Print : Print
|
|
printAll_string (4, a, b, c)
|
|
Print
|
|
|
|
' empty keyboard buffer
|
|
While InKey <> "" : Wend
|
|
Print : Print "hit any key to end program"
|
|
Sleep
|
|
End
|