zoukankan      html  css  js  c++  java
  • 文件操作,Io流。

     private void textBox1_TextChanged(object sender, EventArgs e)
            {
           
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                String path = @"F:666.text";
    //创建文件流. Stream fs = new FileStream(path, FileMode.Open);
    //创建写入器. StreamReader sr = new StreamReader(fs, Encoding.Default);
    //将录入的内容写入文件. string src = sr.ReadToEnd();
    //关闭写入器 sr.Close();
    //关闭文件流. fs.Close(); textBox1.Text = src; } }


    //创建文件流.
    FileStream myfs=new FileSteam(path,FileMode.Open);
    //创建读取器.
    StreamReader mySr=new StremReader(myfs,Encoding.Default);
    //读取文件所有内容
    content = mySr.ReadToEnd();
    txtContent.Text=Content;
    //关闭读取器.
    mySc.Close();
    //关闭文件流.
    myfs.Close();


    读取目录下的子目录信息。
    private void BindInfo(TreeNode node)
    {
    DirectoryInfo directoryInfo =new DirectoryInfo(node.Tag.ToString());
    DirectoryInfo[] dirs = directoryInfo.GetDirectories();
    foreach(DirectoryInfo di in dirs)
    {
    TreeNode temp =new TreeNode();
    temp.Text=di.Name;
    temp.Tag=di.FullName;
    node.nodes.Add(temp);
    }
    }
  • 相关阅读:
    微信支付退款部分代码
    Raspberry PI 点亮LED
    Raspberry PI 摄像头
    RaspberryPI 3B系统烧录
    MySQL基础使用
    MySQL数据库管理系统概述
    Eclipse创建JAVA项目
    Brup Suite拦截https请求
    Github 第一个仓库
    python os模块主要函数
  • 原文地址:https://www.cnblogs.com/2652405350wch/p/6612615.html
Copyright © 2011-2022 走看看