next up previous contents index
Next: Declaring and Using Modules Up: Built in functions Previous: Atom Manipulation Functions   Contents   Index

Input and Output

These functions are impure: they produce side-effects

writef(Fmt Args)

formatted write as per the prolog writef/2

Example:

  writef('hello ~w~n' [world])
writef(Fmt)

formatted write, no arguments
write(X)

write to screen
write(X)

write followed by newline
run(X)

run command in shell X is first converted to a string using atom(X)
!X

syntactic sugar for run(X)
backquote(X)

opens a pipe and runs command X, collects standard out as an atom and returns it. Syntactic sugar: You can instead enclode the command backquote character; e.g. `X`

The following example writes all files in a directory, on one line

  writeln(join(', ' split('\n' `ls`)))


chris mungall 2006-02-09