PrintLine vs. WriteLine

T

tenspeeddrive

According the MSDN,...

The Print/PrintLine functions write display-formatted data to a
sequential file.
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmPrint.asp)

FileOpen(1, "c:\trash.txt", OpenMode.Output) ' Open file for output.
Print(1, "This is a test.") ' Print text to file.
PrintLine(1) ' Print blank line to file.
PrintLine(1, "Zone 1", TAB(), "Zone 2") ' Print in two print zones.
PrintLine(1, "Hello", "World") ' Separate strings with a tab.
PrintLine(1, SPC(5), "5 leading spaces ") ' Print five leading
spaces.
PrintLine(1, TAB(10), "Hello") ' Print word at column 10.

' Assign Boolean, Date, and Error values.
Dim aBool As Boolean
Dim aDate As DateTime
aBool = False
aDate = DateTime.Parse("February 12, 1969")

' Dates and booleans are translated using locale settings of your
system.
PrintLine(1, aBool, " is a Boolean value")
PrintLine(1, aDate, " is a date")
FileClose(1) ' Close file.

The Write/WriteLine functions write data to a sequential file. Data
written with Write is usually read from a file with Input.
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmWrite.asp)

FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
Write(1, "This is a test.") ' Print text to file.
WriteLine(1) ' Print blank line to file.
WriteLine(1, "Zone 1", TAB(), "Zone 2") ' Print in two print zones.
WriteLine(1, "Hello", " ", "World") ' Separate strings with space.
WriteLine(1, SPC(5), "5 leading spaces ") ' Print five leading
spaces.
WriteLine(1, TAB(10), "Hello") ' Print word at column 10.

' Assign Boolean, Date, and Error values.
Dim aBool As Boolean
Dim aDate As DateTime
aBool = False
aDate = DateTime.Parse("February 12, 1969")

' Dates and Booleans are translated using locale settings of
' your system.
WriteLine(1, aBool, " is a Boolean value")
WriteLine(1, aDate, " is a date")
FileClose(1) ' Close file.

It seems to me, that the only lines different are the following:

PrintLine(1, "Hello", "World") ' Separate strings with a tab.
WriteLine(1, "Hello", " ", "World") ' Separate strings with space.

I still need to test these to see if there is indeed any difference,
but, in the meantime, is there a reason to use one over the other? Is
that difference documented anywhere?

TIA
 
C

Cor Ligthert [MVP]

TenSpeed,

In a natural language there are a lot of synonyms with what you can express
yourself.

Visual Basic becomes in my opinion the first program language who meets
that.

A language has to be old to have those aspects.

Just my opinion.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top