首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >InnoSetup: FileSize

InnoSetup: FileSize
EN

Stack Overflow用户
提问于 2015-08-05 10:02:24
回答 1查看 1.1K关注 0票数 1

我需要文件的大小。我需要检查文件是否超过100 b示例:

代码语言:javascript
复制
If FileSize('C:\Program Files\MyProgramm\MyApp.exe') > 100 
   then
     msgbox ('File more then 100', mbinformation,mb_ok)
   else 
     msgbox ('File less then 100', mbinformation,mb_ok)

我看起来像函数FileSize(const名称: String;var大小:整数):布尔;,但这是工作,只有当我需要检查大小正确与否.但我不能多多少少检查

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-05 10:15:55

函数原型中的var关键字意味着需要声明给定类型的变量并将其传递给函数。然后,该变量接收该值。下面是FileSize函数的一个示例:

代码语言:javascript
复制
var
  Size: Integer;
begin
  // the second parameter of the FileSize function is defined as 'var Size: Integer',
  // so we need to pass there a variable of type Integer, which is the Size variable
  // declared above
  if FileSize('C:\TheFile.any', Size) then
  begin
    if Size > 100 then
      MsgBox('The file is bigger than 100B in size.', mbInformation, MB_OK)
    else
      MsgBox('The file is smaller than 100B in size.', mbInformation, MB_OK);
  end
  else
    MsgBox('Reading the file size failed.', mbError, MB_OK);
end;
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31829275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档