Hello,
How can I write to a txt file if an IF stament is true? All I need the txt
file to have is one line, which will be read by a flash file.
some thing like this:
<cfif #answer# EQ OK>
writeToTxtFile("&asnwer=OK")
<cfelse>
writeToTxtFile("&answer=NotOK")
Thanks in advance
dr_bozak - 29 Sep 2004 16:42 GMT
here ya go ...
straight outta cf docs ...
see CFFILE Tag for more options ....
<!---- get current directory as full path where text file will be --->
<!--- this is just to get the full path. you could set it to whereever your
file is --->
<cfset filepath = GetDirectoryFromPath(GetBaseTemplatePath())>
<cfif #answer# EQ OK>
<cffile action = "append" file = "#filepath#/textfile.txt" output =
"&answer=OK">
<cfelse>
<cffile action = "append" file = "#filepath#/textfile.txt" output =
"&answer=NotOK">
</cfif>