VC获取文件大小

来源:互联网 发布:特效字体软件下载 编辑:程序博客网 时间:2024/06/05 09:44

  FILE *fp;
  fp=fopen(filepath, "rb");
  fseek(fp,SEEK_SET,SEEK_END );
  long int size=ftell(fp)/1024;  //ftell(fp):获取文件大小,单位是字节,除以1024之后将单位变为K
  fclose(fp);

  if (size<4)  //如果文件大小小于4k,则将文件拷贝到ErrorFeaFile文件夹中,循环进入下一次循环
  {
   ::MoveFile(filepath,m_strFeaPath+"runFea\\ErrorFeaFile\\"+filename);
   continue;
  }
/*
  CString s;
  s.Format("%u",size);
  AfxMessageBox(s);
*/

 

原创粉丝点击