I'm stuck here ! I hava a txt file that contains only integers , I opened the file and read its contents into an array of characters.

li   $v0, 13       # system call for open file
  la   $a0, file     # output file name
  li   $a1, 0        # Open for writing (flags are 0: read, 1: write)
  li   $a2, 0        # mode is ignored
  syscall            # open a file (file descriptor returned in $v0)
  move $s6, $v0      # save the file descriptor 
  
  
  
  li $v0, 14
  la $a1,arrayChar
  li $a2,1000
  syscall

the problem is how can I convert each decimal character into an integer ??

any help would be appreciated !

ASCII digits can simply be converted to integer binary numbers by subtracting the character '0' from them.

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.