Page 1 of 1

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

Posted: 16 Jan 2015 14:44
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! :-)

Got a solution!

Posted: 17 Jan 2015 4:52
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!

Posted: 18 Jan 2015 20:26
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.