HURRAY!!!! Its working!!!!!
Code:
#include <fcntl.h>
int main()
{
int fp;
unsigned char *op;
fp=open("file.c",O_RDWR);
op = mmap (NULL, sz, PROT_WRITE|PROT_READ, MAP_FILE | MAP_SHARED, fp,0);
printf ("mmap (out) returned %08lx\n", (long)op);
printf("%s \n",op);
return 0;
}
SALEM,Thanks for identifying the flaw. I have become a bit lazy and have stopped error checking in my programs. I needed that..
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!!!