Anyone know how to prevent fileWriteLine from producing an extra line feed the bottom of file?
When I run this
<cfscript> myfile = "/testme.txt"; mystr="hello world"; fileObj = FileOpen( myFile, "write"); fileWriteLine(fileObj,mystr ); fileClose(fileObj); </cfscript>
I get :
hello world char(10)char(13)
FileWriteLIne() always adds a new line character ready for the the next line to be written. But you could get rid of the trailing line by adding the following to your script:
FileWriteLIne()
fileContents = FileRead( myfile ); FileWrite( myfile, fileContents.RTrim() );
cool that is really helpful. Thank you.