CFLib.org – Common Function Library Project

FileReadCom(sPath)

Last updated October 10, 2002

author

Jeff Mathiot

Version: 1 | Requires: CF5 | Library: FileSysLib

Description:
Reads a text file, and returns content as a string. This UDF use VBScript File System Object (IIS Only).

Return Values:
Returns a string.

Example:

<!--- non live example --->
#ReadFileCom("c:\hello.htm")#

Parameters:

Name Description Required
sPath Path to file. Yes

Full UDF Source:

/**
 * Reads a text file, and returns content as a string.
 * 
 * @param sPath 	 Path to file. (Required)
 * @return Returns a string. 
 * @author Jeff Mathiot (brucewillisisnotdead@hotmail.com) 
 * @version 1, October 10, 2002 
 */
function ReadFileCom(sPath){
	var fileContent="";
	var oFSO=CreateObject("COM", "Scripting.FileSystemObject");
	var oFile=oFSO.OpenTextFile(sPath, 1, 0, 0);

	fileContent=oFile.ReadAll();
	oFile.Close();

	return fileContent;
}
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