zoukankan      html  css  js  c++  java
  • C#实现新建文件并写入内容

     1 using System;
     2 using System.IO;
     3 
     4 namespace ConsoleApplication1
     5 {
     6     class Program
     7     {
     8         static void Main(string[] args)
     9         {
    10 
    11             // 创建文件
    12             FileStream fs = new FileStream("test.doc", FileMode.OpenOrCreate, FileAccess.ReadWrite); //可以指定盘符,也可以指定任意文件名,还可以为word等文件
    13             StreamWriter sw = new StreamWriter(fs); // 创建写入流
    14             sw.WriteLine("bob hu"); // 写入Hello World
    15             sw.Close(); //关闭文件
    16 
    17          
    19         }
    20     }
    21 }
    讨饭咯,行行好,给点吧~~~
  • 相关阅读:
    定位 -CLGeocoder
    定位
    定位
    定位- 汽车导航
    定位
    SVN
    githubRepository -- 使用
    git 常用指令
    ipad ------ 与iPhone的差别
    总结
  • 原文地址:https://www.cnblogs.com/thingk/p/3363880.html
Copyright © 2011-2022 走看看