Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#681 closed Bug (Duplicate)

Document 64KB line limit for FileReadLine()

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) > 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

Attachments (0)

Change History (4)

comment:1 Changed 15 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 15 years ago by Valik

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

Duplicate of #679.

comment:3 Changed 15 years ago by Valik

  • Description modified (diff)

comment:4 Changed 15 years ago by Valik

  • Description modified (diff)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.