I have some C++ code from somewhere that reads and writes data in binary format. I want to see what it's reading and writing in the file, so I want to convert it's binary read and write to non-binary read and write. Also, when I convert the binary write to non-binary write, I want it to still be able to read in the information correctly. How can this be done?
The write function:
int btwrite(short rrn, BTPAGE *page_ptr)
{
// long lseek(), addr;
long addr;
addr = (long) rrn * (long) PAGESIZE + HEADERSIZE;
lseek(btfd, addr, 0);
return (write(btfd, page_ptr, PAGESIZE));
}
The read function:
int btread(short rrn, BTPAGE *page_ptr)
{
// long lseek(), addr;
long addr;
addr = (long)rrn * (long)PAGESIZE + HEADERSIZE;
lseek(btfd, addr, 0);
return ( read(btfd, page_ptr, PAGESIZE) );
}