WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Binary Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

BinaryRead File Line by Line


file="C:\Temp\abc.txt" 
fsize=FileSize(file)
buffer=BinaryAlloc(fsize)
;read file into binary buffer
BinaryRead(buffer,file)
endoffile=BinaryEODGet(buffer)

pos = 0
count = 0
While 1
	index = BinaryIndexEx( buffer, pos, @CRLF, @FWDSCAN,0)
	;Unable to locate @CRLF
	if index == -1 then break
	count = count+1
	linelen = index-pos
	linedata=BinaryPeekStr(buffer, pos, linelen)

	Message(StrCat("Line ",count),linedata)

	pos = index + 2
	eod = BinaryEodGet(buffer)-1
	if pos > eod then break
EndWhile

BinaryFree(buffer)

Article ID:   W16389
File Created: 2005:02:18:12:20:16
Last Updated: 2005:02:18:12:20:16