Discussions related to Visual Prolog
Jason_6
Posts: 13
Joined: 4 Jan 2015 13:39

how to get .txt file coded by ANSI ,not by Unicode by default?

Unread post by Jason_6 »

By prolog's built-in function
file::save("DataBaseDB.txt", DataBaseDB)
we could save class facts which we want to "DataBaseDB.txt".
The .txt file coded by **Unicode** by default.
So,
could we get .txt file coded by **ANSI** or else
by some configures or use some codes in Prolog itself?
If it could ,how?
Millions of thanks! :-)
In me the tiger sniffs the rose.
Jason_6
Posts: 13
Joined: 4 Jan 2015 13:39

Got a solution!

Unread post by Jason_6 »

:idea: :idea: :idea:
Guys,today I find a function,

file::save/3
save : (
string FileName,
factDB FactSection,
boolean IsUnicodeFile).

I used to use file::save/2 until I find file::save/3 .
So , I add an argument ,it'll be ok.
Thanks all the same.

welcome to other solutions to out txt file coded in ANSI or else!
In me the tiger sniffs the rose.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

The "normal" way to get control over the file format is by creating a file stream yourself and then save to that:

Code: Select all

        S = outputStream_file::create8("DataBaseDB.txt"),         S:save(databaseDB),         S:close()
There are many create predicates create8 creates a file in the code page your system is set to use, i.e. one that is suitable for your Windows language.
Regards Thomas Linder Puls
PDC
Post Reply