fopen broken

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
mcsummation
Posts: 220
Joined: 23 Jan 2012, 17:07
Location: Round Rock, TX

fopen broken

Post 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.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: fopen broken

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mcsummation
Posts: 220
Joined: 23 Jan 2012, 17:07
Location: Round Rock, TX

Re: fopen broken

Post by mcsummation »

Thank you, that version now creates the file.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests