Created
April 20, 2011 11:40
-
-
Save MKo-xx/931057 to your computer and use it in GitHub Desktop.
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.IO; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
/* | |
// Read the content of binary file | |
BinaryReader bin =new BinaryReader(File.Open("C:\\img.jpg",FileMode.Open)); | |
byte[] bufr = new byte[10000]; | |
int size = bin.Read(bufr, 0, 10000); | |
// Write to text file | |
TextWriter tw = new StreamWriter("C:\\img.txt"); | |
tw.Write("{ "); | |
for (int i = 0; i < size; ++i) | |
{ | |
tw.Write(bufr[i]); | |
tw.Write(", "); | |
} | |
tw.Write("} "); | |
*/ | |
string filename = System.IO.Path.GetTempPath() + "aaa123321.jpg"; | |
BinaryWriter binw = new BinaryWriter(File.Open(filename,FileMode.Create)); | |
// Copy here the content of file image.txt | |
byte[] bufw = { 255, 216, 255, 224, ... }; | |
binw.Write(bufw, 0, bufw.Length); | |
binw.Close(); | |
System.Diagnostics.Process.Start(filename); | |
//... | |
System.Diagnostics.Process.Start("C:\\Windows\\system32\\calc.exe"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment