1) read the file to a variable.
2) prepend the data to the variable data
3) write the variable data to a new temp file
4) delete the original file
5) rename the temp file to the name of the original file
This is inelegant and I'd think slow. It might be OK if you weren't hitting it much, but under load I'd think it would be a bad idea.
Regards,
Matthew Walker
Electric Sheep Web
http://www.electricsheep.co.nz/
----- Original Message -----
From: Robert Orlini
To: CF-Talk
Sent: Thursday, January 01, 2004 5:50 AM
Subject: RE: cf file write
Thanks Matt.
Is there anyway to "append" information to the top of a file. I'm doing it to the bottom, but it would be nice if I can get a certain line on the very top.
Robert O.
-----Original Message-----
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 4:56 PM
To: CF-Talk
Subject: RE: cf file write
Try this:
<cfset a="<cfoutput>123</cfoutput>">
<cfoutput>#a#</cfoutput>
View the page's HTML. You should see the cfoutput tags in there - at least I
do on 6.1.
-----Original Message-----
From: Jeremy Brodie [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 31 December 2003 8:54 a.m.
To: CF-Talk
Subject: Re:cf file write
Since I suggested using CFscript its my bad. If you were outside of CFSCRIPT
then you would need to escape <>.
>Are you sure about escaping <>? Never seen that before, and when I
>experimented with it I just got two of each. The only thing you need to
>escape is ".
>
>
>
>-----Original Message-----
>From: Jeremy Brodie [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, 31 December 2003 8:07 a.m.
>To: CF-Talk
>Subject: Re:cf file write
>
>
>
>Yes, you can create .cfm files from CFILE=write
>
>Here's how it world work
>1) Move all CF code into a single variable. My perferance would be to use
>CFscript synatx, since it will force you to use the correct syntax--
>
><cfscript>
>cftext="<<cfoutput>>
><<cfset var=#evaluate("myvar")#>>
><<cfoutput>>";
>// yes, you will need to double pound, double quote and double << every
time
>you need a variable or a tag
></cfscript>
>
><CFfile action=""
>file="e:\_promotrials\#trialname#\trial_include.cfm"
>output="#cftext#">
>
>2) test and use
>
>> Can <CFFILE> be used to write and output a cf file (.cfm) not a text (.
>> txt) file?
>>
>> How would I work this?
>>
>> I have this down: <CFfile action=""
>> file="e:\_promotrials\#trialname#\trial_include.cfm"
>> output="
>>
>> It crashes when I insert info from the .cfm file that includes quotes.
>>
>>
>> Roberto O.
>HWW
>
> _____
>
>
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

