I/O problem

I just upgrade my swi prolog to version 8.0.3.
I am working to a project of automatic music composition in prolog, but i am not a top programmer.
In previous version 5.something put_byte(128) was accepted in a output stream to a MIDI file. Now the debugger says: “Encoding cannot represent character” using put_char. How can I do?
Thanks,
Luca

Without seeing the code my guess is that you need to use open/4 with an option to have encoding set to octet. See: Wide character support.

Here is an example from working code of mine using it:

open(File, read, In, [type(text), encoding(octet)])

Not sure if you need type(text).

Probably not if you use put_byte/1,2. You probably also want write for put_byte :slight_smile: The advised (and standard) method is

open(File, write, Out, [type(binary)]).
1 Like

Thank you very much, now I try.
Luca