dwl10@amdahl.UUCP (Dave Lowrey) (01/07/86)
C-Power has problemw when trying to access relative disk files.
This is due to the fact that relative files return EOF at the
end of each record, not the end of file. When C-Power's stdio
routines detect any non-zero status from an I/O operation, from
that point on, any other I/O requests for that file return the
non-zero status.
What this means for relative files is that once the first record is read,
and EOF is returned at the end of that record, no other record can be
read, even if the disk is positioned to a new record!
I have written a short routine to fix this problem. It will reset the
status byte for a specific file to zero. In order to use this program,
you will need a program that can edit disk sectors, as you need to
modify the .o file. I have also uploaded the .o file to the C-Power
BBS. As a last resort, you can contact me, and arrange for a copy to
be sent to you.
1. Enter the following program:
/*
* r_status(fileno) - Reset the I/O status for file 'fileno'
*/
extern char c_status[];
r_status(fileno)
int fileno;
{
c_status[fileno-1] = 0;
}
2. Compile the program:
cc rstatus.c
3. a) Load your disk editing program
b) Find the beginning track and sector for rstatus.o
c) Read in that sector.
d) You will see two occurances of the string c_status. These
need to be changed to c$status (The '_' is 0xA4, '$' is 0x24)
e) Write the modified sector back to disk.
You will need to call the r_status routine after any read from
a relative file that could cause a EOF to occur. What I do is call
it each time I re-position the disk to a new sector.
Feel free to contact me if you have any questions, concers, or
suggestions (other than how to spell correctly! :-) ).
--
-------------------------------------------------------------------
Dave Lowrey
"To vacillate or not to vacillate, that is the question....
....or is it?"
...!(<sun,cbosgd,ihnp4}!amdahl!dwl10
[ The opinions expressed <may> be those of the author and not necessarily
those of his most eminent employer. ]