System.IO.Stream
Stream s; //定义一个字节流
怎么往s里面添加字符传呀?

解决方案 »

  1.   

    wwwwwwwwwwwwwwwwwwwwwwwwwwww
      

  2.   

    const int size = 4096;
    byte[] bytes = new byte[4096];
    int numBytes;
    while((numBytes = input.Read(bytes, 0, size)) > 0)
        output.Write(bytes, 0, numBytes);
      

  3.   

    不是很明白呀  可以把Stream s;带上吗?
      

  4.   

    只想把字符串添加到stream里,别的什么都不做
      

  5.   

    stream output=new System.IO.Stream("filename") ;
      

  6.   

    你这个问题其实就是将string转换成byte[]的问题,刚才在网上查了一下,你看行不行:string str = "This is a testing string";
    byte[] bytes = System.Text.Encoding.Default.GetBytes(str);
    s.Write(bytes, 0, bytes.Length);另外,既然是操作字符串,干吗不用TextReader啊?
      

  7.   

    StreamWriter sw = new StreamWriter(s);sw.Writer("XXXXXXX");sw.Close();
    sw.Dispose();
      

  8.   

    6楼的不能执行呀,有错误
    谢谢7楼,我要写一个打印程序 在网上搜的一个函数,要求传一个Stream字节流....
    呵呵,虽然Stream弄好了,可打印功能竟然不能用,郁闷,好在到处求助的时候找到以前学过的一个例题   中了!