![]() |
Forum Index : Microcontroller and PC projects : CMM2: Bug with LOC() or user failure ?
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
What do we think of this one ? > 480MHz Colour Maximite 2 G2 MMBasic Version 5.07.01 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > list "loc_test.bas" Open "foo.txt" For Output As #1 Close #1 Open "foo.txt" For Random As #1 Print Loc(#1) ' Should be 1 Print #1, "foo"; Print Loc(#1) ' Should be 4 Close #1 Open "foo.txt" For Random As #1 Print Loc(#1) ' Should be 4 if the DOS code is a good reference Close #1 > run "loc_test.bas" 0 0 0 Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
void fun_loc(void) { int fnbr; getargs(&ep, 1, ","); if(argc == 0) error("Syntax"); if(*argv[0] == '#') argv[0]++; fnbr = getinteger(argv[0]); if(fnbr == 0) // accessing the console iret = kbhitConsole(); else { if(fnbr < 1 || fnbr > MAXOPENFILES) error("File number"); if(FileTable[fnbr].com == 0) error("File number is not open"); if(FileTable[fnbr].com > MAXCOMPORTS) { // if(fmode[fnbr] & FA_WRITE){ // iret = (*(FileTable[fnbr].fptr)).fptr + 1; // } else { // iret = RoundUptoBlock((*(FileTable[fnbr].fptr)).fptr) -511 + buffpointer[fnbr]; // } } else iret = SerialRxStatus(FileTable[fnbr].com); } targ = T_INT; } WTF? |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
When fixed, shouldn't it be 0 3 3 John |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
It's indexed from 1 according to the manual ... and also according to MMBasic for DOS source code. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Commented out one too many line. Will be fixed in next release. Thanks for the report |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |