【发布时间】:2012-03-10 20:08:14
【问题描述】:
我正在为一个问题编写此代码,我必须从文件中读取整数并将它们存储到数组中以执行其他操作。到目前为止,我已经能够从文件中读取并将它们存储到缓冲区中。
#### Read Data from File
li $v0, 14 # system call for read from file
move $a0, $s6
la $a1, buffer # address of buffer from which to read
li $a2, 1000 # hardcoded buffer length
syscall # read from file
当我这样做时:它成功地在单独的行上显示文件的内容。
li $v0, 4 # syscall for printing a string
la $a0, buffer # load read data in $a0
syscall
我被困在了必须将缓冲区中的这些整数存储到数组中的地方。这是怎么做到的?
【问题讨论】: