i have a fairly big file around 4mbs. i want to open the file up and process each line separetly. the lines arent too big, maximum is around 80 characters per line. so im thinking the best away to go about it is to start at the begining of the line and put each character one by one in a buffer until i read 0Dh then process the buffer and loop it. is there a better way to go about this then moving each character one by one? ill probably need some sample code too cuz i have an asm learning disablilty.:grin:
Posted on 2002-01-11 19:48:48 by smurf
Look at the tuts on memory mapped files, and let windows do the work of loading the file in in chunks. You might want to read a line at a time though:
{read 127 bytes from file}

mov edx, OFFSET MyLineBuffer
mov eax,-127
@@:cmp [edx+eax+127],0dh
je @F
inc eax
jne @B
{oh, this is bad: do something drastic}
ret
@@:add eax,127 ; length of string
{advance position in file by length of string}
{do something with string}
If there is a CR&LF you'll have to adjust the file position by another byte, or adjust the byte that is searched for. You should be able to find the rest of the code you need in the tut. ;)
Posted on 2002-01-11 20:10:50 by bitRAKE