HURRAY!!!! Its working!!!!!
SALEM,Thanks for identifying the flaw. I have become a bit lazy and have stopped error checking in my programs. I needed that..
unsigned char *op;
op = mmap (NULL, sz, PROT_WRITE|PROT_READ, MAP_FILE | MAP_SHARED, fp,0);
printf ("mmap (out) returned %08lx\n", (long)op);
Its printing out the entire file now..
I still have a few issues regarding detecting the end of the file, but I think I can handle it from here
Thanks a lot!!!