class Program { public static bool SaveData(string FileName, byte[] Data) { BinaryWriter Writer = null; string Name = FileName; try { // Create a new stream to write to the file Writer = new BinaryWriter(File.OpenWrite(Name)); // Writer raw data Writer.Write(Data); Writer.Flush(); Writer.Close(); } catch { //... return false; } return true; } static void Main(string[] args) { byte[] bytes = File.ReadAllBytes(@"C:\Users\UserName\Desktop\File.jpg"); string result = System.Text.Encoding.UTF8.GetString(bytes); byte[] bytes2 = System.Text.Encoding.UTF8.GetBytes(result); SaveData(@"C:\Users\UserName\Desktop\File.jpg", bytes2); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)