alkeshtech 0 Light Poster

Hi guys,
I am kinda confused on how to read integers from a file, named input. txt.

Here is what i have:

TITLE MASM Template						(main.asm)

INCLUDE Irvine32.inc
.data
fileName db "input.txt", 0dh, 0ah, 0
fileHandle	 dword	?
err_Msg BYTE "Cannot open file", 0dh, 0ah, 0

.code
main PROC
	call Clrscr
	
	mov ax, seg fileName
	mov ds, ax
	mov	al, 0     
	mov	ah, 3Dh   
	lea  dx, fileName
	int	21h
	jmp	error
	mov	FileHandle, eax
	

error:
	mov edx, err_Msg
        call WriteString
	call CrLf
	exit

main ENDP

END main

This is where i am right now, in opening a file, from which i will be reading integers and stroring them in variables or an array.

What am I doing wrong here?
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.