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: 1288
Location: Paradise Falls
Picnic
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 Reply with quote
eek



Joined: 21 Oct 2006
Posts: 24
eek
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
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: 1288
Location: Paradise Falls
Picnic
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 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.