These counters were added in MZX 2.6, commented out in MZX 2.65 apparently due to them not working correctly, and then removed altogether in the port. They do not appear to have been documented in the changelog ever, and were easy to miss in the help file (where they were documented until 2.81) and probably went unused when they did exist due to bad color coding.
// Don't think anyone was using these and they're crippled // anyway. - Exo /* if(!str_cmp(name,"FREAD_LENGTH")) { if(input_file == NULL) return -1; return filelength(fileno(input_file)); } if(!str_cmp(name,"FWRITE_LENGTH")) { if(output_file == NULL) return -1; return filelength(fileno(output_file)); } */
A short discussion in the old request thread showing how ugly and hackish the current method of reading a file into a string currently is.
A fixed version of Exo's code in these posts:
set "blah.txt" "fread_open" set "fread_pos" -1 set "file_size" "fread_pos" set "fread_pos" 0 set "$string" "fread&file_size&"
This construct, which as a user who does this a lot I can say is really annoying, could be replaced with the much more legible and user-friendly
set "blah.txt" "fread_open" set "$string" "fread&fread_length&"
The fread version can use either fstat or ftell/fseek, but the fwrite version needs ftell/fseek since the file will probably have changes that haven't been flushed.