Convert any file to uppercase Learn programming Visual Basic (VB.net)

Lesson:

File Management


Exercise:

Convert any file to uppercase 52


Objetive:

Write a program to read a file (of any kind) and dump its content to another file, changing the lowercase letters to uppercase.

You must deliver only the ".cs" file, with you name in a comment.


Code:

Imports System
Imports System.IO
Public Class binaryFileToUpper
    Public Shared Sub Main()
        Dim inFile As BinaryReader = New BinaryReader(File.Open("example.exe", FileMode.Open))
        Dim outFile As BinaryWriter = New BinaryWriter(File.Open("example.exe.upper", FileMode.Create))
        Dim filesize As Long = inFile.BaseStream.Length

        For i As Long = 0 To filesize - 1
            Dim b As Byte = inFile.ReadByte()
            If (b >= Convert.ToByte("a"c)) AndAlso (b <= Convert.ToByte("z"c)) Then b -= 32
            outFile.Write(b)
        Next

        inFile.Close()
        outFile.Close()
    End Sub
End Class