-
C#以二进制格式打开和保存文件
C#使用BinaryWriter、BinaryReader对象分别保存和读取二进制文件,程序分两部分,先来看第一部分:
C#以二进制格式保存文件:设置保存文件的格式:
saveFileDialog1.Filter = "二进制文件(*.dat)|*.dat";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
//使用“另存为”对话框中输入的文件名实例化FileStream对象
FileStream myStream = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
//使用FileStream对象实例化BinaryWriter二进制写入流对象
BinaryWriter myWriter = new BinaryWriter(myStream);
//以二进制方式向创建的文件中写入内容
myWriter.Write(textBox1.Text);
//关闭当前二进制写入流
myWriter.Close();
//关闭当前文件流
myStream.Close();
textBox1.Text = string.Empty;
}
打开文件时同样也是以二进制来打开读取文件内容:
//设置打开文件的格式
openFileDialog1.Filter = "二进制文件(*.dat)|*.dat";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = string.Empty;
//使用“打开”对话框中选择的文件名实例化FileStream对象
FileStream myStream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
//使用FileStream对象实例化BinaryRea
- 2022-02-14 18:03:07下载
- 积分:1
-
S6frreedommani
六自由度机械臂调试程序源码,国外的的,具有非常高的借鉴意义
(Six degrees of freedom manipulator debugger source, abroad, the very high reference)
- 2012-07-22 23:31:03下载
- 积分:1
-
change
用于将网络边关系转换成matlab可用的临近矩阵。(Used to convert the network edge into matlab available close relationship matrix.)
- 2013-12-12 16:37:24下载
- 积分:1
-
C
说明: C语言趣味程序百例精解,是PDF格式。里面有很多趣味的例子,大大小小的算法都有,可谓是算法的经典。这个是学习算法的好资料,在学习中找到趣味,完全不同于其他资料的算法枯燥无味(C language program 100 cases of sperm interesting solution is in PDF format. There are many interesting examples of both large and small algorithm, the algorithm can be described as classic. This is a learning algorithm is good information, in learning to find interesting information is completely different from other algorithms dull)
- 2013-06-13 23:01:00下载
- 积分:1
-
Neural-network-quxianbijin
设计并训练三种神经网络使之分别逼近下列函数,精度Sm偏差小于20,Ry偏差小于1.5。 (各变量取值范围: =20~90, =35~55,a1=3~13, a2=0.3~3,Sd=0.05~0.45, =0.05~0.04,L2=0.015~0.06,T=7~110)(Design and training of three neural networks respectively approximation of the following function, precision Sm deviation is less than 20 Ry deviation is less than 1.5. (Each variable ranges: = 20 to 90, a = 35 to 55, a1 = 3 to 13, a2 = 0.3 to 3, Sd = 0.05 ~~ 0.45 = of 0.05 ~~ 0.04 L2 = 0.015 to 0.06, T = 7 ~~ 110))
- 2013-03-17 12:37:39下载
- 积分:1
-
1.CreateViewController
oc编程,将视图控制器添加至UIWindow,若干方法(oc programming, will add a view controller to UIWindow, several methods)
- 2013-12-10 13:49:36下载
- 积分:1
-
ProjectOne_V0
关于用瑞萨单片机使用无线模块的CC1101的源代码。大家交流一下(On the use of Renesas MCU CC1101 wireless module' s source code. We exchange)
- 2013-08-20 16:25:50下载
- 积分:1
-
HeartRateMonitor
ios平台基于蓝牙4.0 HeartRate(latform is based on the Bluetooth 4.0 HeartRate)
- 2014-02-17 15:12:38下载
- 积分:1
-
WinSockUDP
VC UDP通讯,后台服务器
FileMana.cpp
FileMana.h
Login.cpp
Login.h
resource.h
SocketUdp.cpp
SocketUdp.h
StdAfx.cpp
StdAfx.h
WinSockUDP.aps
WinSockUDP.clw
WinSockUDP.cpp
WinSockUDP.dsp
WinSockUDP.dsw
WinSockUDP.h
WinSockUDP.ncb
WinSockUDP.opt
WinSockUDP.plg
WinSockUDP.rc
WinSockUDP.sln
WinSockUDP.vcproj
WinSockUDP.vcproj.T400-CKX.Administrator.user
WinSockUDPDlg.cpp
WinSockUDPDlg.h( FileMana.cpp
FileMana.h
Login.cpp
Login.h
resource.h
SocketUdp.cpp
SocketUdp.h
StdAfx.cpp
StdAfx.h
WinSockUDP.aps
WinSockUDP.clw
WinSockUDP.cpp
WinSockUDP.dsp
WinSockUDP.dsw
WinSockUDP.h
WinSockUDP.ncb
WinSockUDP.opt
WinSockUDP.plg
WinSockUDP.rc
WinSockUDP.sln
WinSockUDP.vcproj
WinSockUDP.vcproj.T400-CKX.Administrator.user
WinSockUDPDlg.cpp
WinSockUDPDlg.h)
- 2012-05-24 14:41:07下载
- 积分:1
-
ShareMemory
c++ 写的共享内存的实例,进程间通信用,已封装类,方便使用,默认大小根据实际情况自由更改(C++ write the sharing memory examples, inter-process communication, already encapsulation class, ease of use, the default size according to the actual situation of the freedom to change
)
- 2012-08-06 13:14:44下载
- 积分:1