Re: read doesn't read back from writeq
- From: "Pierpaolo BERNARDI" <pierpaolo@xxxxxxxxxxxxx>
- Date: 24 May 2006 17:12:52 +0200
On Wed, 24 May 2006 09:44:06 +0200, <newser.bbs@xxxxxxxxxxxxxxxxx> wrote:
1 ?- string_to_atom(S,'This is a test'),
assertz(db_string(S)),
tell('c:\\test.txt'),
writeq(db_string(S)),told.
| | |
S = "This is a test"
Yes
2 ?- see('c:\\test.txt'),
| read(A).
ERROR: c:\test.txt:1: Syntax error: Unexpected end of file
3 ?- Seen.
% ... 1,000,000 ............ 10,000,000 years later
%
% >> 42 << (last release gives the question)
3 ?- see('c:\\test.txt'),
| read(db_string(S)).
No
4 ?-
+++++++++++++++++++++++++++++++++++++++++++++++
See ? The read/1 just doesn't read back the term written by
writeq , although the manual says it does .
You forgot to write a full stop at the end of the term
that you write in the file:
...
writeq(db_string(S)),
writeln('.'),
told.
The swi manual can't say *everything* there's to know about prolog.
As for reading back strings written with writeq, I already
posted a solution to this problem (which I agree is a problem
of swi prolog) in a thread that you started: at the start of
your program, or in your pl.ini file, put the following line:
?- set_prolog_flag(backquoted_string,true).
and then you can writeq strings and read them back (assuming
this is what you want).
P.
--
Anything below this line is being added by the newsserver
Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
.
- Follow-Ups:
- Re: read doesn't read back from writeq
- From: newser . bbs
- Re: read doesn't read back from writeq
- References:
- read doesn't read back from writeq
- From: newser . bbs
- read doesn't read back from writeq
- Prev by Date: new to prolog
- Next by Date: Re: new to prolog
- Previous by thread: read doesn't read back from writeq
- Next by thread: Re: read doesn't read back from writeq
- Index(es):