Announcement

Collapse
No announcement yet.

Text file export

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Text file export

    I am exporting comma delimited data to a random text file(myfile.txt). I cannot locate
    or remember the code to place in the last field to force a linefeed or indicate end of record.
    My work around is to retrive the file in Word and then save as text file with line breaks.
    Then I can retrive the file in Excel to play with the data.

    I need to bypass the Word conversion to add line breaks at the end of each record.

    Can anyone Help?

    Thanks in Advance

    Bruce

    ------------------

  • #2
    Bruce,

    I don't know if I totally follow you but why not simply put a CR/LF at the end?

    dos/windows
    ..fielddata$ & chr$(13) & chr$(10)

    unix/linux
    ..fielddata$ & chr$(13)



    ------------------
    -Greg
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

    Comment


    • #3
      Greg --

      I thought Unix used LF only, not CR only.

      -- Eric

      ------------------
      Perfect Sync: Perfect Sync Development Tools
      Email: mailto:[email protected][email protected]</A>

      "Not my circus, not my monkeys."

      Comment


      • #4
        Yes, UNIX uses LF (CHR$(10)). CR only (CHR$(13)) can be found in
        Macintosh text files..

        ------------------

        Comment


        • #5
          Greg

          Thanks you. I guess "keep it simple" is best.

          Many Thanks

          Bruce


          ------------------

          Comment


          • #6
            I am not sure which file you need to add the CR/LF to.
            But if it is the random text file (i.e. a fixed length record) and you use a Type to define the record then just do this:

            Type myType
            Field1 As String *10
            Field2 As String *10
            ....
            CRLF As Integer
            End Type
            ....
            Local rcType as myType
            rcType.CRLF = 2573

            where the number 2573 in integer format for chr$(13) & chr$(10).

            This technique has a beneficial side effect if you build the record from different data sources and wish to send error message that contain the current (incomplete) record to an error handling subroutine
            you just define an AsciiZ pointer an set the rcType.crlf to zero and now you have an Asciiz string

            local pType as AsciiZ Ptr
            rcType.CRLF = 0
            pType = VARPTR(rcType)

            Now @pType is a valid AsciiZ String

            Then after you return from the sub

            reset rcType.CRLF = 2573

            I use it all the time

            Joe Murphy

            ------------------

            Comment


            • #7
              Joe

              Many thanks for the added info.

              Bruce

              ------------------

              Comment

              Working...
              X