I read 100 bytes of text in file.that's ok. Then i use it, clear buffer, and i have to read another 100 bytes from file, which i dont know how to do. Can anybody tell me how to do it or post a an example?
Thanks in advance
7 replies to this topic
#1
Posted 22 November 2009 - 08:24 AM
|
|
|
#2
Posted 23 November 2009 - 08:34 AM
Are you having trouble with opening the file, reading from the file, reading only 100 bytes at a time, or something else?
#3
Posted 23 November 2009 - 12:25 PM
Opening file - no problems
reading first 100bytes - no problems
reading another 100bytes - that's the problem
reading first 100bytes - no problems
reading another 100bytes - that's the problem
#4
Posted 23 November 2009 - 12:47 PM
Is it the looping or the flushing the buffer that's an issue?
#5
Posted 23 November 2009 - 10:42 PM
the issue is that i dont know how make code read not first 100 bytes but another 100 bytes
#6
Posted 24 November 2009 - 12:43 AM
Just move the file pointer to where you want to read from:
Here's what you need to do:
Interrupt 21H, subfunction 42H (i.e. AH=42h)
AL - seek mode
* 0 - SEEK_SET
* 1 - SEEK_CUR
* 2 - SEEK_END
BX - file handle
CX:DX - signed offset to move the file pointer.
Returns:
* DX:AX - new offset of file pointer from start of file (i.e. SEEK_SET)
* CF set on error, AX has error code in that case.
* Error codes: AX=0 means "Invalid function", AX=6 means "Invalid file handle".
;same as lseek(file_handle, 100, SEEK_SET) mov ax, 4200h mov bx, filehandle xor cx,cx mov dx, 100 int 21h ;optional, just in case something goes wrong jc ERROR_FILE_SEEK ;no error, move on with life. NOW is when ;you can read the next 100 bytes.
Here's what you need to do:
Interrupt 21H, subfunction 42H (i.e. AH=42h)
AL - seek mode
* 0 - SEEK_SET
* 1 - SEEK_CUR
* 2 - SEEK_END
BX - file handle
CX:DX - signed offset to move the file pointer.
Returns:
* DX:AX - new offset of file pointer from start of file (i.e. SEEK_SET)
* CF set on error, AX has error code in that case.
* Error codes: AX=0 means "Invalid function", AX=6 means "Invalid file handle".
sudo rm -rf /
#7
Posted 25 November 2009 - 06:20 AM
thanks for info, i would like also to know how to overwrite text in file. I was serching for function which deletes text, but i didn't find any infornation. Maybe i can you writting function (3Fh) to overwrite text? can anybody help?
#8
Posted 25 November 2009 - 11:08 AM
Yes, just position the file pointer where you want to overwrite and just write out your buffer.
sudo rm -rf /
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









