Discussions related to Visual Prolog
dcgreenwood
Posts: 14
Joined: 16 Jan 2021 1:33

How to use file::save

Unread post by dcgreenwood »

I want to write a series of facts to a file, but I can't find any explanation about how to write facts to a file in any of the documentations. Only a few vague references that you can do it. Here is just a simple example of what I am trying to do

Code: Select all

class facts     testDB : (string Name).   class predicates     filltestDB : (). clauses     filltestDB() :-         assert(testDB("Name1")),         assert(testDB("Name2")),         file::save("TestFile", testDB(_)).
but this gives me
error c504 :The expression has type 'main::main@classDB', which is incompatible with the type '::factDB'

Can you point me to a good explanation of writing to files, or give me some basics here?
Vitaly Markov
Active Member
Posts: 41
Joined: 30 Nov 2003 0:01

Re: How to use file::save

Unread post by Vitaly Markov »

Code: Select all

class facts - dbName     testDB : (string Name).   class predicates     filltestDB : (). clauses     filltestDB() :-         assert(testDB("Name1")),         assert(testDB("Name2")),         file::save("TestFile", dbName).
dcgreenwood
Posts: 14
Joined: 16 Jan 2021 1:33

Re: How to use file::save

Unread post by dcgreenwood »

Thanks!
Post Reply