Created
December 13, 2011 12:52
-
-
Save Chrisso/1472033 to your computer and use it in GitHub Desktop.
C# Base64-Encoder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
public class Base64EncodeApp | |
{ | |
public static void Main(string[] args) | |
{ | |
if (args.Length < 1) | |
{ | |
Console.WriteLine("usage: base64-encode.exe <filename>"); | |
return; | |
} | |
using (FileStream fs = File.OpenRead(args[0])) | |
{ | |
byte[] data = new byte[fs.Length]; | |
fs.Read(data, 0, (int)fs.Length); | |
Console.WriteLine(Convert.ToBase64String(data)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment