Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create an output file with 80 char records and not cr's 1

Status
Not open for further replies.

llmoore

Programmer
Jun 4, 2002
13
0
0
US
I need to create an output file with 80 character records and no carriage returns or line feeds.
Using Visual Basic 6.
I am trying to use the Open FileName for binary as #1, Put #1, , DataLine. Anytime I use a variable to hold the data that I need to write, the record contains 4 extra bytes at the start of each record. I have read in the Microsoft Knowledge base the extra bytes were add in VB6 when using the put statement.

Thanks for any help.

Loren Moore
 
The extra 4 bytes only occur if DataLine is dimmed as a variant datatype. Use string datatype.
 
I do have DataLine dimmed as string. I will supply some more of my code.

Private sub Output()
Dim DataLine as String
Open FileName For Binary as #1
DataLine = SuperHeader
Put #1, , DataLine
Close #1
End Sub

Public Function SuperHeader() As String
SuperHeader = Build Data 80 Character Line
End Function

The only way I have found not to get the extra bytes is to
Put #1, ,"01"

Thanks - SonOfEmidec1100
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top