CFLib.org – Common Function Library Project

Get(BVar, loc)

Last updated November 15, 2002

Version: 1 | Requires: ColdFusion MX | Library: DataManipulationLib

 
Rated 0 time(s). Average Rating: 0

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:

view plain print about
<!---
<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:

view plain print about
<cfscript>
/**
 * 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;
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson