Skip to content


Read text from a file or process handle

Syntax: read0 x, read0[x]

Returns data from text file or handle. Where x is a


returns the lines of the file as a list of strings. Lines are assumed delimited by either LF or CRLF, and the delimiters are removed.

q)`:test.txt 0:("hello";"goodbye")  / write some text to a file

q)/ read 500000 lines, chunks of (up to) 100000 at a time
q)d:raze{read0(`:/tmp/data;x;100000)}each 100000*til 5

File handle

returns a line of text from it.

q)rl:{1">> ";read0 0}
>> xiskso

Reading the console permits interactive input.

q)1">> ";a:read0 0
>> whatever
q)a[4+til 4]

File descriptor

i.e. a list of the form (file; offset; length), returns bytes from file.

q)`:foo 0: enlist "hello world"
q)read0 (`:foo;6;5)

Starting with V3.4 2016.05.31 read0 allows user to specify how many bytes to read from a Fifo.

"Red Hat "

File and process handles
Basics: File system