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;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson