Expand/Shrink

puts / printf

Definition: puts(integer fn, object x, cleanup=true)
Description: Output, to file or device fn, a single byte (atom) or sequence of bytes. The low order 8-bits of each value is actually sent out. If fn is the screen you will see text characters displayed.
pwa/p2js: Supported, for fn=1 or 2 and string x only. The new (1.0.2) optional third parameter is entirely for the benefit of puts() in p2js.js - it can only be set to false, and apart from checking for that it is completely ignored by desktop/Phix [that is, in pmain.e/ParamList()]. The idea is to output valid html directly without the usual substitution, an example of that can be found in demo\rosetta\Queen_Armies.exw, and of course you need to run that in a browser to get the benefit.
Comments: When you output a sequence of bytes it must not have any (sub)sequences within it. It must be a atoms only (typically ascii codes), or a string.
Example 1:
puts(SCREEN, "Enter your first name: ")
Example 2:
puts(output, ’A’)  -- a single byte/character is written to output
Implementation: via :%opPuts in builtins\VM\pfileioN.e (an autoinclude) - be warned however it is low-level complicated stuff that you do not need to know.
See Also: printf, gets, open
puts1(s) is a low-level equivalent of puts(1,s), see builtins\puts1h.e (not an autoinclude) and builtins\VM\puts1.e (an autoinclude).