IF Computer > MINERVA > Manual > Reference > Predicates > Text Processing and Regular Expressions > get_line/1/2

get_line/1/2

MINERVA
ifcomputer logo
f
Expert Services on the Web

get_line(-result)

get_line(+stream, -result)

get_line/1/2 reads a line. Fails on EOF.

Arguments

	result		atom
	stream		atom

Example

Copy a file. Invoke e.g. with minerva -l copyfile aaa.txt bbb.txt
	main([Infile,Outfile|_]) :-
	        open(Infile,read,Instream),
	        open(Outfile,write,Outstream),
	        copy(Instream,Outstream),
	        close(Instream),
	        close(Outstream).

copy(Instream,Outstream) :- get_line(Instream,Line), write(Outstream,Line),nl(Outstream), copy(Instream,Outstream). copy(_Instream,Outstream) :- flush_output(Outstream).

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

regular expression, match/2/3, match_all/3, substitute/4, substitute_all/4, split/2/3, chop/2, get_line/1/2,

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/regexp/get_line/print_de.html
published 2008/12/1 update 2002/3/20 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS