• c++ 获取文件大小


    #include "stdafx.h"

    #include<windows.h>

    #include<iostream>

    int _tmain(int argc, _TCHAR* argv[])

    {

      TCHAR * filePath=TEXT("F:\安装软件\DiffMerge_4.1.0.534.stable_x86.zip");

      HANDLE hr=CreateFile(filePath,0,0,0,OPEN_EXISTING,0,0);

      DWORD size=0;

      if(hr==INVALID_HANDLE_VALUE)

      {

        size=0;

      }

      else

      {

      size=GetFileSize(hr,0);

      }

      CloseHandle(hr);

      std::cout<<size<<std::endl;

      return 0;

    }

  • 相关阅读:
    8.5
    8.12
    8.11
    8.14
    8.15
    8.18
    8.16
    8.20
    Android新版NDK环境配置(免Cygwin)
    在Windows7上搭建Cocos2d-x win32开发环境
  • 原文地址:https://www.cnblogs.com/chenheng0056/p/3434118.html
Copyright © 2020-2023  润新知