[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Print ASCII new line character (decimal 10)

Posted on 2004-04-01
7
Medium Priority
?
2,878 Views
Last Modified: 2008-03-10
Hi,

I need to write a txt output file in which each record in terminated
with a ASCII new-line charecter(decimal 10).
Can you please let me know how to get this done using VB functions.

Thanks,
Siva.
0
Comment
Question by:sivavb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 9

Expert Comment

by:dancebert
ID: 10732860
0
 
LVL 9

Expert Comment

by:dancebert
ID: 10732882
Ok, that was a little cryptic.  What you need to do is add the vbNewLine character to the end of your string then write the string to the output file.  For example:

dim s as string
s = "This is my data and that is my newline" & vbNewLine

Do you also need to know how to write the string to an output file?


0
 

Author Comment

by:sivavb
ID: 10732912
Hi ,

I need to print some values in each record of the file and then add a new line charecter at
the end

I doing as follows.Will it serve the puropse ?

Print #FileNum2, iCT_ID; "|"; sRecDate; "|"; sRecTime; "|"; chr(10)

Let me know if there are any issues ?

Thanks,
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 9

Expert Comment

by:dancebert
ID: 10733212
Looks ok to me, but I didn't try running it.
0
 

Expert Comment

by:pyromatt
ID: 10734055
Use;

Print #FileNum2, iCT_ID & "|" & sRecDate & "|" & sRecTime & "|" & vbCrLf

Should work...
Matt.
0
 

Accepted Solution

by:
pyromatt earned 150 total points
ID: 10734103
Btw, if your interested...

vbCrLf = chr(13) & chr(10)

As far as i know, you need to use both 13 AND 10, as 13 goes back to the beginning of the line and 10 goes down a line, so you end up at the very beginning of a new line.


0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 10977389
Option Explicit
'If you need chr(10) only - and not also chr(13)
'you can go also this way
Private Sub Command1_Click()
    Dim sText As String
    Dim theBreak As String
    theBreak = Chr$(10)
    Dim lCounter As Long
    Dim intFree As Integer
    sText = "Put your text" & theBreak
    For lCounter = 1 To 10
        sText = sText & "This is line n° " & lCounter + 1 & theBreak
       
    Next
    'print on file
    intFree = FreeFile
    Open "c:\test.txt" For Binary As #intFree
        Put #intFree, , sText
    Close #intFree
End Sub
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question