Reading socket input stream until period is encountered

Hello,

i am trying to read from a socket until a period is encountered.

It seems that: read_line_to_string(IStream,S1), or read_line_to_codes(IStream,S2),

does not work – since they read until a newline or end of file (i think).

Is there a way to instruct reading until a delimiter is enountered (i.e. the period)

thank you,

Dan

just noticed: read_line_to_codes (+Stream, -Line, ?Tail) and the example, which somehow reads to a delimiter – will try to get my head around the example.

Another part of SWI-Prolog that I have not used but am aware. This one might become your best new friend. :slightly_smiling_face:

lazy_lists.pl – Lazy list handling

thanks.

I guess this would need to be a “low level” list – that (lazily) gets chars until, i guess, it encounters the dot. and the DCG grammar essentially recognizes a string with a period in the end.

That sounds, Interesting, i will try this out

Dan

Try read_string/5

great. thanks.