我正在尝试从输入文件中读取文本,将其存储在缓冲区中然后将其打印出来。我很确定我的代码是正确的,mars.jar文件与.s和.txt文件在同一目录中。有谁可以帮我弄清楚为什么它不会打印出文本?
这是代码:
.data
buffer: .space 1024
inputFile: .asciiz "aufgabe1.txt"
.text
main:
#open file
li $v0, 13 #syscall for open file
la $a0, inputFile #input file name
li $a1, 0 #read only
li $a2, 0 #mode is ignored
syscall
move $s0, $v0 # save the file descriptor
#read from file
li $v0, 14 #syscall for reading
move $a0, $s0 #file descriptor
la $a1, buffer #address of buff
li $a2, 1024 #buff length
syscall
#print buffer to check
li $v0, 4 #
la $a0, buffer # buffer contains the values
syscall # print int
#end program
li $v0, 10
syscall