日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C#操作文本文件實例淺析

C#操作文本文件是如何實現(xiàn)的呢?讓我們開始講述吧:

站在用戶的角度思考問題,與客戶深入溝通,找到邯鄲網(wǎng)站設計與邯鄲網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站制作、成都做網(wǎng)站、外貿營銷網(wǎng)站建設、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名注冊、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務覆蓋邯鄲地區(qū)。

 
 
 
  1. using System.IO;  
  2.  
  3. //聲明控件  
  4. protected System.Web.UI.HtmlControls.HtmlTextArea txtValue; 

C#操作文本文件之讀取文本文件:

 
 
 
  1. //主程序  
  2. FileStream   fsInfo = new  FileStream(   
  3. "文件路徑(在項目內的)", FileMode.Open, FileAccess.Read );  
  4. StreamReader  srInfo  =  new StreamReader(   
  5. fsInfo, System.Text. Encoding.GetEncoding( "GB2312" ) );  
  6. srInfo.BaseStream.Seek( 0, SeekOrigin.Begin );  
  7. txtValue.Value  = " ";  
  8. string strLine  = srInfo.ReadInfo();  
  9. while( strLine != null )  
  10. {  
  11. txtValue.Value  +=   strLine  + "\n";  
  12. strLine   =   srInfo.ReadLine();  
  13. }  
  14. srInfo.Close(); 

C#操作文本文件之寫入文本文件:

 
 
 
  1. //主程序  
  2. FileStream fsInfo  = new FileStream(  
  3.  文件路徑(在項目內的)", FileMode.OpenOrCreate, FileAccess.Write );  
  4. StreamWriter swInfo = new StreamWriter( fsInfo );  
  5. swInfo.Flush();  
  6. swInfo.BaseStream.Seek( 0, SeekOrigin.Begin );  
  7. swInfo.Write( txtValue.Value );  
  8.  
  9. swInfo.Flush();  
  10. swInfo.Close(); 

C#操作文本文件的基本實現(xiàn)內容就向你介紹到這里,希望對你了解和學習C#操作文本文件有所幫助。


當前題目:C#操作文本文件實例淺析
當前地址:http://m.5511xx.com/article/dhhjssc.html