Closed venomix666 closed 7 months ago
You do need to clear some. I don't know why they're not cleared for you. See F_OPEN here: https://www.seasip.info/Cpm/bdos.html EX, S1, S2, RC and CR are the ones specified in the documentation. S2 is cleared for you in the code but I forget why.
For clearing the whole structure... memset and fcb = {}
should be equivalent in C. Really they should both produce a tiny embedded loop as that'd be more efficient than calling out to a function but I don't know whether llvm-mos does that or not.
Thanks for the clarification, then it is just my poor knowledge of CP/M which is the issue. I assumed that cpm_file_close would set up the FCB used by fcb_file_open or fcb_file_create for a new file.
The fcb = {} syntax is more elegant for sure. I am still getting used to these 'modern' (i.e. anything not supported by Watcom ;) ) additions to C.
Closed by #115
I have an issue in vt52term, where I reuse a global static FCB struct for opening files for both sending and receiving with Xmodem. If I only open/close the files, I get strange behavior such as the file position from the previous file being remembered when opening a new file.
I currently have a working fix where I use memset to zero the entire FCB before starting a new file operation. This works fine, but is this the way it is intended to be done? I tried just setting ex to zero, but this did not solve the problem.
I guess this boils down to two questions: