below the procedure of reading from text file using 8086 microprocessor and tasm and storing the text in array called array.
note that data_file is a db variable contains the name of the file with its directory,, |c:\tasm\file_name|,,
MOV AH, 3DH ;Open the file
MOV AL, 0 ;Open for reading
LEA DX, data_file ;Presume DS points at filename
INT 21H ; segment
MOV HANDLE, AX ;Save file handle
XOR SI, SI
MOV AH , 3FH ;Read data from the file
LEA DX, array[SI] ;Address of data buffer
MOV CX, 40 ;Read 256 bytes
MOV BX, HANDLE ;Get file handle value
How would you read the size of an input file (like input.txt) and have the program dynamically determine how long it is without allocating a certain amount of space for it. More specifically, I'm trying to read the contents of two input files and have one perform mathematical operations on the other file. Then, to write the output, the program would have to know how long the input file was so it knows how many times to loop to write to the output file. All of the files are planned to be in quad word format.