-1

I have a problem I cant seem to solve alone..

   li   $v0, 13             # open file to write
   la   $a0, file           # load file
   li   $a1, 258            # file flag write & create
   li   $a2, 0x1FF          # mode: something i googled xD
   syscall

After I created the file and write stuff into it and the file & program closes, the file becomes write-protected/read-only. Is there a possibility to remove that? I'd like to run the function multiple times for testing stuff and if it is write-protected I can't open the data to re-write it.

File contains an absolute path, like: "C:/User/[..]/test.txt" Im running the program using QtSpim and the cause of the write-protection can only be caused by the code from above(atleast I hope that's the case, because all I do is write stuff in it & close it again).

I hope someone knows the solution

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
nofavor
  • 19
  • 2

1 Answers1

0

I'm not sure where you got the value 258 from. The recognized flags AFAIK are:

0: read-only.
1: write-only.
9: write-only with append.

I'm not sure if 9 is supported by SPIM, but it should work in MARS.

The mode is ignored, so it shouldn't matter what you set it to.

Michael
  • 57,169
  • 9
  • 80
  • 125