Wiki source for KeyPgCvs


Show raw source

{{fbdoc item="title" value="CVS"}}----
Converts a 32-bit integer or 4-byte string to a single-precision variable

{{fbdoc item="syntax"}}##
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Cvs** ( [[KeyPgByval|byval]] //i// [[KeyPgAs|as]] [[KeyPgInteger|integer]] ) [[KeyPgAs|as]] [[KeyPgSingle|single]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Cvs** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgSingle|single]]
##
{{fbdoc item="usage"}}##
//result// = **Cvs**( //i// )
//result// = **Cvs**( //str// )
##
{{fbdoc item="param"}}
##//i//##
A 32-bit ##[[KeyPgInteger|Integer]]## with a binary copy of a single-precision variable stored in it.
##//str//##
A ##[[KeyPgString|String]]## at least 4 bytes in length with a binary copy of a single-precision variable stored in it.

{{fbdoc item="ret"}}
Returns a ##[[KeyPgSingle|Single]]## value holding a binary copy of the input value.

{{fbdoc item="desc"}}
Does a binary copy from a 32-bit ##[[KeyPgInteger|Integer]]## or 4-byte ##[[KeyPgString|String]]## to a ##[[KeyPgSingle|Single]]## variable. A value of zero (##0.0##) is returned if the string is less than 4 bytes in length. The result will make sense only if the parameter contained a IEEE-754 formatted single-precision value, such as one generated by ##[[KeyPgCvi|Cvi]]## or ##[[KeyPgMks|Mks]]##.

This function is useful to read numeric values from buffers without using a ##[[KeyPgType|Type]]## definition.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/strings/cvs.bas"}}%%(freebasic)
dim f as single, i as integer
f = 1.125
i = cvi(f)

print using "i = _&H&"; hex(i)
print using "cvs(i) = &"; cvs(i)
%%

{{fbdoc item="diff"}}
- QB did not support integer arguments.

{{fbdoc item="see"}}
- ##[[KeyPgMks|Mks]]##
- ##[[KeyPgCvd|Cvd]]##
- ##[[KeyPgCvi|Cvi]]##

{{fbdoc item="back" value="CatPgString|String Functions"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode