In my app (which I can't show the source) there's a line that checks FileSize(file$) for a file's location but it keeps returning -1 for not found.
So I put "SetClipboardText(file$)" before it, and it looked normal. But then I pasted the copied clipboard text into a hex editor and it shows Chr(0) at the start of the copied text. WTF? It's obviously why FileSize() is returning -1 but since when can a string have Chr(0) in it?
If I use "Debug Len(file$)" it returns 17, but file$ is "D:\Temp\WTF.xlsx" which is only 16 characters. The extra 1 is due to Chr(0) at the start?
Using PureBasic 6.10 (64-bit) on Win 10 Pro, but it also happens with 6.20 Beta 2.

[Edit] I just added this debugging code and got the following result. Some strange leading character that looked like Chr(0) when pasted into HxD.
Code: Select all
For i=1 To Len(file$)
c=Asc(Mid(file$,i,1))
Debug Str(i)+" = "+Str(c)+" ("+Chr(c)+")"
Next
Code: Select all
1 = 8234 ()
2 = 68 (D)
3 = 58 (:)
4 = 92 (\)
5 = 84 (T)
6 = 101 (e)
7 = 109 (m)
8 = 112 (p)
9 = 92 (\)
10 = 87 (W)
11 = 84 (T)
12 = 70 (F)
13 = 46 (.)
14 = 120 (x)
15 = 108 (l)
16 = 115 (s)
17 = 120 (x)