CFLib.org – Common Function Library Project

Get(BVar, loc)

Last updated November 15, 2002
Download UDF

author

John Bartlett                                     John Bartlett

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:

<!---
<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:

<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>

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson