“colon (':') expected” compiler error on character range in case statement in Inno Setup Pascal script

余生长醉 提交于 2019-11-29 12:22:44

The Ansi version of Inno Setup does not seem to support ranges in case statement.

So you have to enumerate the set:

case C of
  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': B := ...;
  ...
end;

In what case it's probably better to use if:

if (C >= '0') and (C <= '9') then

Though even better, use the Unicode version of Inno Setup. It's 21st century, you should not develop non-Unicode applications anymore. See Upgrading from Ansi to Unicode version of Inno Setup (any disadvantages). And Inno Setup 6 has Unicode version only anyway.


You better use the CryptStringToBinary Windows API function for the hex to binary conversion anyway. See my answer to your other question Writing binary file in Inno Setup.


Note that there are lot of other problems with your code.

  • You are subtracting char from integer.
  • The Inno Setup does not have a two argument overload of Inc.
  • TStream.WriteBuffer takes string, not byte.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!