peek_char/1 doesn't just peek, but actually consumes
characters when reading from a stream. For instance:
?- open(atom('abc'), read, IO), see(IO),
get0(C1), peek_char(_), get0(C2),
atom_codes(A,[C1,C2]), writeln(A),
seen, close(IO).
prints `ac' and 'b' is missing.
I am quite certain that this was not the case with the
old file_read/2 when it was reading from a string.
Logged In: YES
user_id=13069
Yes, strgetc was incorrectly being used to get the next
character. I've introduced a macro strpeekc to return the
next character but not advance the pointer. Your example
now works.
-David
Logged In: YES
user_id=13069
(Forgot to close it...)