[mercury-users] Some more Queries
Ralph Becket
rafe at cs.mu.OZ.AU
Mon Nov 11 17:15:45 AEDT 2002
Noel Pinto, Monday, 11 November 2002:
>
> I have modified the code as to the one you suggested. It compiles
> well and the code is below...
Good. Do you now understand the difference between a switch and an
if-then-else?
> While executing the code... I get a runtime error
> $ ./test3
> Error occured.
> Syntax error at variable `Dude': operator or `.' expected
>
>
> blah.txt file contains the following text...
> Hey Dude.
[...]
io__read_binary/3 expects to see data in the format written out by
io__write_binary/3. This format is not public, so you shouldn't
expect to be able to generate it by hand. Put another way, the idea
behind io__write/read_binary is to be able to efficiently save and
restore values computed by a Mercury program. And that's all. So you
shouldn't be using io__read_binary/3 if you aren't reading in stuff that
was written out using io__write_binary/3 in the first place.
If you just use io__read/3 instead, then it expects to see syntactically
well formed plaintext Mercury terms of the appropriate type. For
instance, if you want to read strings in your file should contain lines
of the form
"Hey Dude".
"This is another string".
etc.
- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list