Discussions related to Visual Prolog
mdosnov2016
VIP Member
Posts: 73
Joined: 19 Nov 2016 7:58

file5x::write

Unread post by mdosnov2016 »

Hello all.

My write predicate call fails with error message:

Exception in module ...
<pre>pfc/stream/stdiostate.pro(7) : error r329: Single fact 'outputStream'</pre>
from internal database 'stdioState : stdioState@objectDB' has no value


and it terminates.
My code excerpt is as follows:

Code: Select all

  file5x::writedevice(fileSelector::screen),   file5x::write(" backend HLS CCC optimization started, please wait..."),  
What am I doing wrong?

thank you,
Michael
PrologUser
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Assuming that you are in a console program it seems that the console has not been initialized.

The normal way (currently) to do this is in the goal like this:

Code: Select all

goal     console::runUtf8(main::run).
This code will:
  • Initialize the console
  • Make the console stream the standard output stream
  • Setup exception handling and dumping
  • Run main::run in that context
The first and second bullets are important because that also defines the fileSelector::screen device (because that is the standard output stream).
Regards Thomas Linder Puls
PDC
mdosnov2016
VIP Member
Posts: 73
Joined: 19 Nov 2016 7:58

Unread post by mdosnov2016 »

Thank you Thomas.

And if I want from inside the Prolog code to write/read to/from different files (e.g. .log) do I need
to initialise them the same way?
What would be then an example of code (call)?

Best regards,
Michael
PrologUser
mdosnov2016
VIP Member
Posts: 73
Joined: 19 Nov 2016 7:58

Unread post by mdosnov2016 »

Dear Thomas,
I tried adding the code that you proposed,
but when I reach this point in the VIP8 debugger it tells me:
error: console cannot be initialised.

Can't I run it with the debugger?

Best regards,
Michael
PrologUser
mdosnov2016
VIP Member
Posts: 73
Joined: 19 Nov 2016 7:58

Unread post by mdosnov2016 »

Actually I just created a brand new console type project and I placed in place of main.pack my backend.pack.

Now I can see the messages written on screen in my console window.
Thank you,

Michael
PrologUser
Post Reply