Futurebasic/Language/Reference/cvi

= CVI function =

Function
✔ Appearance ✔  Standard ✔  Console

Description
This function converts the bytes in  into an integer value which has the same internal bit-pattern that   has. If  consists of 4 or more bytes, only its first 4 bytes are considered. If  consists of 1, 2 or 3 bytes, then   returns an 8-bit, 16-bit or 24-bit integer, respectively. If  is a null string, then   returns zero.

This function is useful for finding the integer form of such things as file types, creator signatures and resource types. For example:

After executing the above,  is then suitable for passing to a Toolbox routine which requires a file-type parameter. will also have the same value as the integer constant

The size (in bytes) of the value returned by  depends on the length of. It does not depend on the current setting of. Therefore, if you want to assign the return value of  to a short integer variable, you must make sure that   is not longer than 2 bytes; otherwise, you'll get an unexpected value in your short integer variable. Similarly, if you want to correctly assign 's return value to a byte variable, you should make sure that   is not longer than 1 byte.

The  function is the inverse of. Note, however, that the output of  does depend on the current setting of.

Note
If  is 1 byte long, then   returns the same value as.