zoukankan      html  css  js  c++  java
  • C#文本文件的操作

    FileStream fsInfo = new FileStream( "文件路径(在项目内的)", FileMode.Open, FileAccess.Read ); StreamReader srInfo = new StreamReader( fsInfo, System.Text. Encoding.GetEncoding( "GB2312" ) ); srInfo.BaseStream.Seek( 0, SeekOrigin.Begin ); txtValue.Value = " "; string strLine = srInfo.ReadInfo(); while( strLine != null ) { txtValue.Value += strLine + "/n"; strLine = srInfo.ReadLine(); } srInfo.Close(); 写入文本文件: //主程序 FileStream fsInfo = new FileStream( 文件路径(在项目内的)", FileMode.OpenOrCreate, FileAccess.Write ); StreamWriter swInfo = new StreamWriter( fsInfo ); swInfo.Flush(); swInfo.BaseStream.Seek( 0, SeekOrigin.Begin ); swInfo.Write( txtValue.Value ); swInfo.Flush(); swInfo.Close();
  • 相关阅读:
    iis环境异常处理
    cmd常用命令:关机、注销、进入d盘等
    position
    Register Form
    第一周
    Django简介
    前端jQuery基本语法
    前端基础BOM和DOM
    HTML常用标签
    Linux相关 MySQL相关
  • 原文地址:https://www.cnblogs.com/xiaotuni/p/2365734.html
Copyright © 2011-2022 走看看