[fpc-pascal] Unicodestrings and Assign(File)

Jürgen Hestermann juergen.hestermann at gmx.de
Thu May 10 07:17:56 CEST 2012


Jonas Maebe schrieb:
 >> I was able to access long paths (with many hundreds of characters)
 >> in the windows API functions FindFirstFileW (with Win32_Find_DataW
 >> data type) but I failed to open such files with Assign(File)/reset.
 >> Are they converted to (one byte) Ansistring internally?
 > So as far as I can see, he was in fact asking whether the regular RTL 
functions (such as assign/reset)
 > already included unicodestring support. He already knew that it works 
fine if you use the Windows APIs directly.

Correct. Accessing long paths under Windows can only be done when using 
Unicode (widestring) paths (prepended with '\\?\') for Windows API 
functions that end with W.

It is easy to replace the RTL FindFirst/Next functions by the Windows 
API functions FindFirst(Next)FileW but when I want to open a found file 
I am not able to use Assign/Reset to open them (i.e. text files). I am 
just wondering how it will still be possible to open such long paths 
with the Windows API function CreateFile and use Readln and other file 
functions afterwards. Is it possible to somehow fill the file data 
structure with vaild data other than using Reset/Rewrite? I can get a 
file handle with CreateFile but when using readln I have to hand over a 
text file data structure...




More information about the fpc-pascal mailing list