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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHAT IS THIS AT THE END OF MY TEXT FILE? 1

Status
Not open for further replies.

faxpay

Programmer
Nov 30, 2004
119
US
I have a text file with about 40 lines and at the end of the file, on a line all by itself at the very left, is a small box with the letters "SUB" inside it. I copied it below and it shows up as a small square.

Can anyone tell me what this is????


820000002603576693510000000000000000040892221204696825 121108250000001
9000001000003000000260357669351000000000000000004089222


Just a little square.

faxpay,
Tom
 
The ASCII SUB character is &H1A, 26 in decimal, also known as Ctrl-Z or ^Z.

This was the old DOS "end of file" text file marker, inherited from CP/M (which had no EOF byte count in its file header blocks). Many programs will still place a ^Z at the end of a text file on output.

Why do text files end in Ctrl+Z?

Code:
Private Sub Command1_Click()
    Dim f As Integer
    
    f = FreeFile(0)
    Open "data.txt" For Output As #f
    Print #f, "Line 1"
    Print #f, "Line 2"
    Print #f, Chr$(26);
    Close #f
    
    MsgBox "Created"
End Sub

Private Sub Command2_Click()
    Dim f As Integer, l As String
    
    f = FreeFile(0)
    Open "data.txt" For Input As #f
    Do Until EOF(f)
        Line Input #f, l
    Loop
    Close #f
    
    MsgBox "Last line: " & l
End Sub
After clicking Command1, then Command2, the second MsgBox will show "Last line: Line 2" which shows that the ^Z is handled without incident or error when using VB6 native I/O to read the file in text mode.
 
diletante,

That is exactly where this file was generated in an old DOS program. Thank You. Now I know this is not a necessary character for my upload to an entity.

Sometimes I wonder how you people find answers to these things.

Thanks Again.

faxpay,
Tom
 
diletante,

By the way. What is that (MIS) after your name? Is that Microsoft Information Services? and if so are you with Microsoft?

Excuse my ignorance.

faxpay,
Tom
 
No, just means "Management Information Systems" and it is probably a lousy classification these days.

Nobody here but us chickens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top