• C#中如何读写文件,控制台


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;

    namespace ConsoleApplication1
    {
        class Program
        {
            public static void Main()
            {
                string[] s = { "c:\\", "d:\\", "e:\\", "f:\\" };
                using (StreamWriter sw = new StreamWriter("1.ini", false))
                //false为直接覆盖该文件,true就直接添加在文件末尾
                {
                    foreach (string t in s)
                    {
                        sw.WriteLine(t);
                    }
                }
                using (StreamReader sr = new StreamReader("1.ini"))
                {
                    String temp = "";
                    string ss = sr.ReadLine();
                    while (ss != null)
                    {
                        temp += ss;
                        Console.WriteLine(temp);
                        ss = sr.ReadLine();
                    }
                }
                Console.ReadLine();
            }
        }
    }

  • 相关阅读:
    Struts2异常:HTTP Status 404
    Struts2的Action编写
    Struts2异常:HTTP Status 404
    Struts2的核心配置文件
    Struts2入门1
    Hibernate的批量抓取
    Hibernate检索策略
    Hibernate的HQL多表查询
    Hibernate入门4
    Hibernate异常:MappingException
  • 原文地址:https://www.cnblogs.com/lixiaolun/p/2831373.html
Copyright © 2020-2023  润新知