| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1299 人关注过本帖
标题:[分享]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
快速回复:[分享]C#代码
数据加载中...
 
   



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

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