[root@luozhonghua 03]#cat ex03-open-03.c/*文件ex03-open-03.c,O_CREAT和O_EXCL的使用*/include#include#include#include int main(void){ int fd=-1;char filename[]="test.txt;打开文件,如果文件不存在,则报错*/fd=open(filename,O_...
推荐的方法:#include<sys/stat.h>unsigned long get_file_size(const char*pPath){ unsigned long nFileSize=-1;struct stat statbuff;if(stat(pPath,&statbuff)>=0){ nFileSize=statbuff.st_size;} return nFileSize;...