#include #include #include #include #define TRUE 0 #define FALSE -1 void main(void){ int fildes = FALSE; struct stat info; char* tmpbuf; long tmplen, m_byte_red; if((fildes = open("/A001/INDEX.HTM", O_RDONLY)) == FALSE){/* OPEN ERR */ perror("FAILED OPEN"); exit(0); }/* OPEN ERR */ lstat("/A001/INDEX.HTM", &info); tmplen = (int)info.st_allocsize; tmpbuf = (char*)malloc(tmplen); memset(tmpbuf, 0, sizeof(tmpbuf)); m_byte_red = read(fildes, tmpbuf, tmplen); close(fildes); tmpbuf[m_byte_red] = 0x00; free(tmpbuf); printf("%s\n", tmpbuf); getchar(); }