标题:流不支持写入?
只看楼主
jj_shasha
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-5-21
 问题点数:0 回复次数:1 
流不支持写入?
using System;
using System.Collections.Generic;
using System.Text;
using

namespace ConsoleApplication4
{
  
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                FileStream fs = new FileStream(@"d:\hh.txt", FileMode.OpenOrCreate, FileAccess.Read);
                byte[] hh = new byte[6] { 65, 66, 67, 68, 69, 70 };
                foreach (byte b in hh)
                {
                    fs.WriteByte(b);
                }
                fs.Position = 0;
                for (int i = 0; i < fs.Length; i++)
                {
                    Console.Write((char)fs.ReadByte());
                    fs.Close();
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
            finally
            {
                System.Threading.Thread.Sleep(1111111111);
            }
        }
    }
}
流不支持写入
应该怎么修改???
搜索更多相关主题的帖子: using System byte FileStream args 
2008-05-21 11:02
hebingbing
Rank: 6Rank: 6
来 自:黄土高坡
等 级:贵宾
威 望:27
帖 子:3417
专家分:371
注 册:2007-10-22
得分:0 
FileAccess.ReadWrite
2008-05-21 11:10



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




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

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