Reading the docs, it seems i cannot have
unicode file names, but i can read and write
unicode data. And this is independent of the file encoding, i can read and write WSTRINGs from and to an ASCII encoded file, so basically unicode strings work with files, but real unicode file names fail. If you change "s" in my previous code example from string to wstring, it will work with the same file name, but with Russian characters, it fails (so there must be some conversion from wstring to string under the hood for the "open" statement).
Code: Select all
dim s as string
dim w as wstring * 16
s = "d:\asdf.txt"
w = "asdf"
open s for binary as #1
put #1,, w
close #1
w = ""
open s for binary as #1
get #1,, w
close #1
s = ""
s = w
print s
print len(s)
sleep
I ran my test in Windows, so for a unicode file name i will have to resort to "_wfopen" from the C runtime or make use of the windows API (createfile ...), i think.
How about Linux? I remember having read somewhere that in Linux _wfopen isn´t available, but "fopen" would accept UTF-8 encoded file names instead. Is this true?
JK