Embed a hex character in a text file

S

Shane

I have an old program that terminates text files with a hex (1A).
MS-DOS programs used to need the Control-Z character to terminate text
files.

I need to create new text files in .NET that will embed the Control-Z
as well.

How do I do that?

I'm thinking of something like this, but I can't figure out the syntax.

Dim sw As New StreamWriter("C:\Test.txt", False,
System.Text.Encoding.UTF8)

sw.Write("This is line 1" & ControlChars.Lf)
sw.Write("This is line 2" & ControlChars.Lf)
sw.Write("This is line 3" & ControlChars.Lf)
sw.Write(Char(26)) <--- This is the syntax that I can't figure out
sw.Close()

Thanks.
 

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