﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3789	Fileread() returns empty string when variable > 2GB	Exit	Jon	"2GB is the maximum variable size in Autoit.
If this size is reached with Fileread() due to UTF8 2 byte processing, then @extended shows 1073741823 read bytes, but the resulting string is empty.
I think Fileread() should show @error > 0 .
Here a reproducer: 
{{{
; proof 2GB Variable fileread Error

#AutoIt3Wrapper_UseX64=y
#include <String.au3>
$sTestDir = @TempDir & ""\~Test~\""
DirCreate($sTestDir)
FileDelete($sTestDir & ""*.txt"")
ShellExecute($sTestDir)

OnAutoItExitRegister(_Exit)
Func _Exit()
	ToolTip("""")
	MsgBox(64 + 262144, Default, ""Check SciTE output to verify Fileread() error."" & @LF & @LF & ""Then press OK to exit."", 0)
	DirRemove($sTestDir, 1)
	Sleep(500)
	WinClose(""[TITLE:"" & StringLeft($sTestDir, 3) & ""; CLASS:CabinetWClass]"")
EndFunc   ;==>_Exit

$iLength = 1024 * 1024 * 1024    ;  1 Gigabyte
$s1GB = _StringRepeat(""-"", $iLength)
$iLength -= 3

For $i = 1 To 2
	ToolTip(""Writing Record #"" & $i & "". This takes a while. Stay tuned."")
	Beep(1000, 100)
	$iLength += 1
	$hFileHandle = FileOpen($sTestDir & $i & "".txt"", 2)
	$sInitData = StringLeft($i & $s1GB, $iLength)
	FileWrite($hFileHandle, $sInitData)
	FileSetPos($hFileHandle, 0, 0)
	$sReadData = FileRead($hFileHandle)
	ConsoleWrite(@LF & ""Fileread $i:"" & $i & "" Error: "" & @error & "" Extended: "" & @extended & @LF & ""    Datalen: "" & StringLen($sInitData) & @LF & ""ReadDatalen: "" & StringLen($sReadData) & @LF & ""ReadData(first 10 Bytes): >"" & StringLeft($sReadData, 10) & ""< "" & @LF & ""Stringcompare Result: "" & (StringCompare($sInitData, $sReadData, 1) ? ""NOT"" : """") & "" equal"" & @LF & @LF)
	ToolTip("""")
	If StringCompare($sReadData, $sInitData, 1) Then Exit MsgBox(16 + 262144, Default, ""Compare Error. I="" & $i, 0)
	FileClose($hFileHandle)
Next

}}}

and here the resulting SciTE output:

{{{

Fileread $i:1 Error: 0 Extended: 1073741822
    Datalen: 1073741822
ReadDatalen: 1073741822
ReadData(first 10 Bytes): >1---------< 
Stringcompare Result:  equal


Fileread $i:2 Error: 0 Extended: 1073741823
    Datalen: 1073741823
ReadDatalen: 0
ReadData(first 10 Bytes): >< 
Stringcompare Result: NOT equal
}}}

"	Bug	closed	3.3.15.4	AutoIt	3.3.14.0	None	Fixed		
