private byte [] StreamFile(string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open,FileAccess.Read);
// Create a byte array of file stream length
byte[] ImageData = new byte[fs.Length];
//Read block of bytes from stream into the byte array
fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));
//Close the File Stream
fs.Close();
return ImageData; //return the byte data
}
This function is used to convert file into byte array. some time we require to convert file into byte to save into database or send to other system using remoting.
分享到:
相关推荐
图像数据库演示 该项目将图像存储为二进制文件,并从... // Convert image into a byte array try { cntDatabase . Open (); string insertQuery = @" INSERT INTO Images(Image) VALUES(@Image) " ; // @Image is a
// Read image file to byte array FileStream fs = new FileStream(@"E:\c.jpg", FileMode.Open, FileAccess.Read); Byte[] btye2 = new byte[fs.Length]; fs.Read(btye2, 0, Convert.ToInt32(fs.Length)); fs...
Tabs Function Declarations and Definitions Function Calls Conditionals Loops and Switch Statements Pointer and Reference Expressions Boolean Expressions Return Values Variable and Array ...
The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored,...
PEP 3112: Byte Literals PEP 3116: New I/O Library PEP 3118: Revised Buffer Protocol PEP 3119: Abstract Base Classes PEP 3127: Integer Literal Support and Syntax PEP 3129: Class Decorators PEP ...
- fix for rangecheck exception with paintpages array - fix for footer and page mirror - doubleclick word selection now stops at NL - Workaround for Windows Spooler problems - some images would get ...
Restructured the AML ParseLoop function, breaking it into several subfunctions in order to reduce CPU stack use and improve maintainability. (Mikhail Kouzmich) AcpiGetHandle: Fix for parameter ...
- Implemented fine-grained SMC detection (on 128 byte granularity) - Bugfixes for CPU emulation correctness and stability - Fixed failures on Big Endian hosts ! - Print detailed page walk ...
§10.1.11 使用 product_user_file来限制用户使用产品 220 §10.2 常用技巧 221 §10.2.1 long 类型的查询 222 §10.2.2 如何确定执行时间 222 §10.2.3 如何终止用户会话 222 §10.2.4 用TRANSLATE对数据加密和解密...