Page 1 of 1

How to use file::save

Posted: 1 Apr 2021 0:13
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?

Re: How to use file::save

Posted: 1 Apr 2021 10:37
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).

Re: How to use file::save

Posted: 1 Apr 2021 13:48
by dcgreenwood
Thanks!