CFLib.org – Common Function Library Project

Get(BVar, loc)

Last updated November 15, 2002

author

John Bartlett

Version: 1 | Requires: CF6 | Library: DataManipulationLib

Description:
This UDF will return the ASCII value of a specified character in a BINARY file. (Get is a throwback to the BASIC days of GET/POKE for fetching/changing bytes in memory.) Note: You may not change any value stored in the binary array - an error will occur.

Return Values:
Returns a string.

Example:

<!---
<cffile action="READBINARY" file="file name" variable="Data">
<CFLOOP index="loop" from="1" to="100">
    <CFOUTPUT>#Chr(Get(Data,loop))#</CFOUTPUT>
</CFLOOP>
--->

Parameters:

Name Description Required
BVar Binary variable. Yes
loc Location in the binary file. Yes

Full UDF Source:

/**
 * Examine the contents of a BINARY file.
 * 
 * @param BVar      Binary variable. (Required)
 * @param loc      Location in the binary file. (Required)
 * @return Returns a string. 
 * @author John Bartlett (jbartlett@strangejourney.net) 
 * @version 1, November 15, 2002 
 */
function Get(BVar,loc) {
    if (isBinary(BVar) EQ "No") return 0;
    if (BVar[loc] GTE 0) return BVar[loc];
    return BVar[loc] + 256;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson