Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#681 closed Bug (Duplicate)

Document 64KB line limit for FileReadLine() — at Version 3

Reported by: PsaltyDS Owned by:
Milestone: Component: Documentation
Version: 3.2.13.10 Severity: None
Keywords: Cc:

Description (last modified by Valik)

Based on this support topic: FileReadLine problem read a very big line http://www.autoitscript.com/forum/index.php?showtopic=84354

FileReadLine() uses a 64K buffer that will return a longer single line as multiple 64K lines. For example, 96K line will be read out as a 64K line, then a 32K line.

Jon indicates this is not a bug, so documentation should be updated reflect the limitation.

Demo: {{{
Global $sFile = "test.txt", $hFile, $n
Global $sLine = "012345467890"
FileDelete($sFile)

; Create large line
Do

$sLine &= $sLine

Until Stringlen($sLine) > 216
ConsoleWrite("Actual line length = " & StringLen($sLine) & @LF)

; Open file
$hFile = FileOpen($sFile, 2) ; Overwrite
For $n = 1 To 10

; Write 10 lines

FileWriteLine($hFile,$sLine)

Next
FileClose($hFile)

; Test with FileReadLine()
$n = 1
While 1

$sLine = FileReadLine($sFile, $n)
If @error Then ExitLoop
ConsoleWrite("Line " & $n & " length = " & StringLen($sLine) & @LF)
$n += 1

WEnd
}}}

Change History (3)

comment:1 Changed 16 years ago by PsaltyDS

...screwed up the code tags, trying again:

Demo:

Global $sFile = "test.txt", $hFile, $n
Global $sLine = "012345467890"
FileDelete($sFile)

; Create large line
Do
    $sLine &= $sLine
Until Stringlen($sLine) > 2^16
ConsoleWrite("Actual line length = " & StringLen($sLine) & @LF)

; Open file
$hFile = FileOpen($sFile, 2) ; Overwrite
For $n = 1 To 10
	; Write 10 lines
    FileWriteLine($hFile,$sLine)
Next
FileClose($hFile)

; Test with FileReadLine()
$n = 1 
While 1
	$sLine = FileReadLine($sFile, $n)
	If @error Then ExitLoop
	ConsoleWrite("Line " & $n & " length = " & StringLen($sLine) & @LF)
	$n += 1
WEnd

comment:2 Changed 16 years ago by Valik

  • Resolution set to Duplicate
  • Status changed from new to closed

Duplicate of #679.

comment:3 Changed 16 years ago by Valik

  • Description modified (diff)
Note: See TracTickets for help on using tickets.