flat assembler
Message board for the users of flat assembler.

Index > DOS > Read a line from file

Author
Thread Post new topic Reply to topic
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 06 May 2007, 00:12
My first post, hello all !

i can open-read-write but
using 8086 code how can i read a specific line only from a text file.
for example i wanna read only line 6 and place the whole line in a buffer.
some tips please.

Sorry for bad English.
Post 06 May 2007, 00:12
View user's profile Send private message Visit poster's website Reply with quote
eek



Joined: 21 Oct 2006
Posts: 24
eek 06 May 2007, 01:16
From an old file of mine:

mov ah,3F ;<read
mov al,00 ;<bl has file handle
mov cx,00FF ;<btyes to read to buffer, value is up to you
int 21

;Then you have to look through the buffer for line breaks

cmp w[si],0A0D ;look for line break in buffer
ifz-call L3

So if you loop the line break you can find line 6.
Post 06 May 2007, 01:16
View user's profile Send private message Reply with quote
eek



Joined: 21 Oct 2006
Posts: 24
eek 06 May 2007, 02:17
There is also int21 ah42

...if you can be bothered figuring it out Very Happy
Post 06 May 2007, 02:17
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 06 May 2007, 09:06
thanks for the answer eek.
I have to look for line breaks, i got it Razz
Post 06 May 2007, 09:06
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.