I am using binary readers and writers to read / write data to a file. For example for this:

MyWriter.Write(Ord(TMyEnum(2)));

I would expect it to write down SmallInt to be read with

MyReader.ReadSmallInt

But in IDE I see it writes down byte. How do I force the writer to write the type that I want?

有帮助吗?

解决方案

Cast it to Smallint

Smallint(SomeEnum)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top