Page 1 of 1

fopen broken

Posted: 25 Feb 2012, 05:36
by mcsummation
I had been running on version lms_arm_nbcnxc_131_20111019_1659.rfw. Today, I decided to update to the test_release20120205 of the compiler/assembler and lms_arm_nbcnxc_132_20120214_2114.rfw. However,

Code: Select all

byte file;
file = fopen("xycoord.txt", "w");
was returning a 0 for the file handle (it had been returning 1). I then tried lms_arm_nbcnxc_132_20120205_1737.rfw and got the same error. I went back to the 12/12/2011 version of the compiler/assembler and got the same thing. Went back to lms_arm_nbcnxc_131_20111019_1659.rfw and it works with both the 12/12/2011 and 2/5/2012 versions of the compiler/assembler. So, it appears that fopen is broken in the firmware.

Re: fopen broken

Posted: 25 Feb 2012, 15:38
by afanofosc
I am uploading a fixed version of the firmware right now. I broke the BRCMP opcode when I added the absolute variable BRCMP opcode a couple weeks ago.

http://bricxcc.sourceforge.net/test_rel ... 5_0932.rfw

I have tested it with this new version of the ex_fopen.nxc file and it seems to work now.

Code: Select all

task main()
{
  byte handle;
  remove("test.txt");
  handle = fopen("test.txt", "w");
  NumOut(0, LCD_LINE1, handle);
  if (handle != NULL)
  {
    fputs("testing", handle);
    fclose(handle);
    handle = fopen("test.txt", "r");
    NumOut(0, LCD_LINE2, handle);
    if (handle != NULL)
    {
      string msg;
      fgets(msg, 7, handle);
      TextOut(0, LCD_LINE3, msg);
    }
  }
  Wait(SEC_5);
}
John Hansen

Re: fopen broken

Posted: 25 Feb 2012, 16:36
by mcsummation
Thank you, that version now creates the file.