|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFFILE APPEND at the beginning
Hi all,CFDEV 06/01/04 11:13 A Prepending to a file involves reading and rewriting the file. CFFILEKatz, Dov B (IT) 06/01/04 11:19 A <cfset crlf = chr(13) & chr(10)>Pascal Peters 06/01/04 11:26 A Thanks a lot,CFDEV 06/01/04 11:32 A Hi all, The cffile append function append a document at the end..how could I insert a line at the beginning instead? Thanks Pat Prepending to a file involves reading and rewriting the file. CFFILE read, and CFFILE write with #newstring# newline #existing file# But if it's a one time thing, you might want to do this dynamically when you output the file by outputting the "header" line before the file content. HTH -dov _____ Sent: Tuesday, June 01, 2004 11:11 AM To: CF-Talk Subject: CFFILE APPEND at the beginning Hi all, The cffile append function append a document at the end..how could I insert a line at the beginning instead? Thanks Pat _____ <cfset crlf = chr(13) & chr(10)> <cffile action="READ" file="#variables.file#" variable="out"> <cfset out = "my line here" & crlf & variables.out> <cffile action="WRITE" file="#variables.file#" output="#variables.out#" addnewline="No"> Of course, this requires reading the whole file. If you are on cfmx, maybe this can be done in java? Pascal ----- Excess quoted text cut - see Original Post for more ----- Thanks a lot, I tought of that but I was sonwdering if there was something I missed in the append attributes to facilitate the manipulation... Thank you Pat _____ Sent: June 1, 2004 11:21 To: CF-Talk Subject: RE: CFFILE APPEND at the beginning <cfset crlf = chr(13) & chr(10)> <cffile action="READ" file="#variables.file#" variable="out"> <cfset out = "my line here" & crlf & variables.out> <cffile action="WRITE" file="#variables.file#" output="#variables.out#" addnewline="No"> Of course, this requires reading the whole file. If you are on cfmx, maybe this can be done in java? Pascal ----- Excess quoted text cut - see Original Post for more ----- _____
|
September 09, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||