Just Code‎ > ‎

Show Hexadecimal representation of a file, neat for checking encoding of the file

posted Feb 12, 2010, 1:49 AM by Peter Henell   [ updated Feb 12, 2010, 1:52 AM ]
Read bytes from a file, convert the values to hex and display them.

DO NOT USE ON BIG FILES!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;

namespace ConsoleApplication4
{ class Program
{ static void Main(string[] args) { byte[] buffer = File.ReadAllBytes(@"c:\temp\Orginal.txt"); foreach (var item in buffer) { Console.Write("0x{0:X} ", item); Console.ReadKey(); } Console.ReadLine(); } } }
Comments