IT-Berater: Theo Gottwald (IT-Consultant) > Freebasic

FreeBASIC file operations with CWstr

(1/2) > >>

Juergen Kuehlwein:
I thought i would open a new thread for file operations, because the other one is getting quite lengthy...

José,

i remember you posting somewhere, you had classes for unicode file operations, but i cannot find them (other than "CFileSys.inc, CFileTime.inc and CFindFile.inc) in WinFBX. Running own tests in FreeBASIC, it seems i cannot have unicode file names, but i can read and write WSTRINGs to and from files. So the real shortcoming is at the "OPEN" statement, all others work with WSTRING - is this correct ?


JK

José Roca:
> So the real shortcoming is at the "OPEN" statement, all others work with WSTRING - is this correct ?

None of the FB instrinsic procedures that deal with files accept unicode file names.

José Roca:
> i remember you posting somewhere, you had classes for unicode file operations, but i cannot find them (other than "CFileSys.inc, CFileTime.inc and CFindFile.inc) in WinFBX.

There are many classes and procedures to work with files in unicode.
See: https://github.com/JoseRoca/WinFBX/tree/master/docs/File%20Management

Juergen Kuehlwein:
Ok, i cannot have unicode file names, but i can have unicode file data - can you confirm that? In other words: once i have opened a file, i can read and write WSTRINGs from and to it, at least this is what a quick test seems to show.


--- Code: ---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

--- End code ---

JK

José Roca:
I haven't tried with binary files, but it works with files opened with OPEN using "utf16" encoding.

Navigation

[0] Message Index

[#] Next page

Go to full version