标题:[分享]C#代码
取消只看楼主
风情
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-3-31
 问题点数:0 回复次数:0 
[分享]C#代码

using System; using System.IO;

namespace _06_10 { public class Class_06_10 { public static void Main(String[] args) { FileStream fs = File.Open("output.txt", FileMode.Create); BinaryWriter bw = new BinaryWriter(fs);

bool b = true; int i = 20000; double d = Math.PI; decimal de = (decimal)d * (decimal)d; string s = "你好";

bw.Write(b); bw.Write(i); bw.Write(d); bw.Write(de); bw.Write(s);

bw.Close();

fs = File.Open("output.txt", FileMode.Open); BinaryReader br = new BinaryReader(fs);

bool b1; int i1; double d1; decimal de1; string s1;

b1 = br.ReadBoolean(); i1 = br.ReadInt32(); d1 = br.ReadDouble(); de1 = br.ReadDecimal(); s1 = br.ReadString();

Console.WriteLine("b1 = {0}", b1); Console.WriteLine("i1 = {0}", i1); Console.WriteLine("d1 = {0}", d1); Console.WriteLine("de1 = {0}", de1); Console.WriteLine("s1 = {0}", s1);

br.Close(); fs.Close(); } } }

搜索更多相关主题的帖子: Write decimal 代码 using 
2005-04-08 21:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-15133-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023111 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved