FileReadCom(sPath)
Last updated October 10, 2002
Version: 1 | Requires: ColdFusion 5 | 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:
#ReadFileCom("c:\hello.htm")#
Parameters:
| Name | Description | Required |
|---|---|---|
| sPath | Path to file. | Yes |
Full UDF Source:
<cfscript>
/**
* 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;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
10 day(s) ago
Will Belden added
longTime
16 day(s) ago
James Sleeman added
quickSort
26 day(s) ago
Ben Forta added
GetHostAddress
29 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)