Reference/Number

From Kx Wiki
Jump to: navigation, search

File handles are integers, file descriptors created with hopen or callback numbers created using a shared library.

If the file handle is a callback, then this executes the callback.

If the file handle points to an actual file, then this *writes* to the file.

q)a:hopen`:file.txt
q)a "first "
q)a "word\n"
q)hclose a

If the file handle is negative and points to an actual file, then a newline is included:

q)a:hopen`:file.txt
q)neg[a] "first line"
q)neg[a] "second line"
q)hclose a

If the file handle is zero (`0`) then this writes to the console.

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox