-
C# 텍스트파일 읽기프로그래밍/C# (WinForms, ASP.NET) 2018. 3. 14. 10:17반응형
1. 텍스트파일 한줄 씩 읽기
using (System.IO.StreamReader sr = new System.IO.StreamReader("FileName")) { string line; while ((line = sr.ReadLine()) != null) { Console.WriteLine(line); } }
2. 텍스트파일 처음부터 끝까지 읽기
using (System.IO.StreamReader sr = new System.IO.StreamReader("FileName")) { Console.WriteLine(sr.ReadToEnd()); }
반응형'프로그래밍 > C# (WinForms, ASP.NET)' 카테고리의 다른 글
C# DateTimePicker 기본값 설정하기 (0) 2018.03.27 C# 간단하게 구현한 CheckBox ComboBox (with CheckedListBox) (1) 2018.03.15 C# 텍스트파일 읽기 (1) 2018.03.14 C# 엑셀파일 가져오기 using Microsoft.Office.Interop.Excel (DataGrdiVeiw에 바인딩 포함) (8) 2018.01.10 C# 바이너리 파일 읽기 (한글 포함) (0) 2018.01.09 C# 병렬 foreach, Parallel.ForEach (0) 2018.01.02 TAG
관리자의 승인을 기다리고 있는 댓글입니다