Skip to main content
Participant
April 25, 2008
Question

FileReadLine() bug - SOLVED

  • April 25, 2008
  • 1 reply
  • 316 views
I have a file that has HTML along with coldfusion tags. I have to read in data files then somehow get this HTML file to the users PC as a word doc. I thought I could use the FileReadLine() to read a line then use the CFFILE action append to write a file to the server. I found that when <HTML> was read in nothing was written to the file. If I change the text to HTML> then HTML> is written out. I put a cfoutput tag in my function to output what was passed, when <HTML> was read the function received nothing or spaces, when HTML> was read the function received HTML>.
    This topic has been closed for replies.

    1 reply

    Inspiring
    April 25, 2008
    How about you post your code?

    --
    Adam
    cr6137Author
    Participant
    April 25, 2008
    Here is my code
    <cfscript >
    myfile = FileOpen("C:\ColdFusion8\wwwroot\OIG Generator\oig.txt","read");
    while (! FileIsEOF(myfile))
    {
    x = FileReadLine(myfile);
    writefile(x);
    }
    </cfscript>
    <cffunction name="writefile">
    <cfargument name="lineToWrite">
    <cfoutput>#lineToWrite#</cfoutput>
    <cfabort>
    <cffile action="append" file = "#variables.OIG_file##EnvCount#.txt"
    output = "#lineToWrite#">
    </cffunction>