#include #include #include #include #ifdef VAX #include #else #include #endif int file_length(int f); main() { char *bf="1234\n"; int i; int len = strlen(bf); int h_his; int total=0; h_his = open("test.dat",O_RDWR | O_CREAT,0); write(h_his,bf,len); close(h_his); for (i=0; i<10; i++) { h_his = open("test.dat",O_RDWR,0); printf("File Length %d \n",file_length(h_his)); write(h_his,bf,len); close(h_his); } } #ifdef VMS #include #else #include #endif int file_length(int f) { struct stat bf; fstat(f,&bf); return bf.st_size; }