1

I need to read two lines of string from file Input.txt as

15/02/1996
25/05/1332

and I don't know how to read the second string in the new line. I tried many ways and read lots of documents but I can't solve this. Any help would be highly appreciated.

Khai bao

.data fi: .asciiz "input.txt" fo: .asciiz "output.txt" buffer1: .space 11 buffer2: .space 10 .text

Open

li $v0, 13  
la $a0, fi  #a0 = file name
li $a1, 0   #a1 = 0 (0: read, 1: write)
li $a2, 0   #a2 = 0 (0: ignore mode)
syscall
move $t1, $v0   

Read data

li $v0, 14  
move $a0, $t1   
la $a1, buffer1 
li $a2, 11  
la $a1, buffer2
li $a2, 10
syscall

Close

li $v0, 16  # close file
move $a0, $t0   
syscall
Justin
  • 1,006
  • 12
  • 25
Nhi Nguyen
  • 11
  • 2

0 Answers0