SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    taking a new line in a txt file

    Hi
    I've created a text file from data in an SQL database, its putting all the text onto one line
    I'm trying to output each field onto a new line, can anyone let me know what im missing,
    heres the code im using:

    <cffile action = "write"
    file="Location of text file"
    output = "
    Number: #Test_Key#
    UserName: #Test_UserName#
    User Email: #Test_UserEmail#
    Company: #Test_company# ">

    Thanks

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #chr(13)# at the end of each line has done the job for me

  3. #3
    SitePoint Enthusiast Adam Chrapkowski's Avatar
    Join Date
    Sep 2011
    Location
    Poland
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    New line in a plain text is LF or CR LF. CR is a carriage (hex 0x0D, or "\r" for many programming languages ) return and LF is a line feed (hex 0x0A, or "\n" for many programming languages). Additional information can be found in the ASCII table. ASCII(8-bit) is a subset of Unicode so everything which refers to ASCII also refers to Unicode.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    My Notepad++ editor has 3 settings for end of line conversions

    Windows - CRLF
    Unix - LF
    Mac - CR

    Normally not much of a problem except once when I was checking file hashes on my Windows localhost and my Linux site server.

    "Identical" files (as far as I could see), but the EOL difference resulted in there being different hash values.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •