- 전체
- Native Apps
- WinJS App
- C# Apps
- XAML
- VB.net
- VisualC.net
- C++
- MFC
- visual studio mobile app dev
- Azure ms cloud service
- Asp.net
- 인공지능 (AI)
- wpf
- UWP
- MAUI
- asp.net
C# Apps 텍스트 파일을 한 번에 한 줄씩 읽기(Visual C#)
2017.08.30 21:44
방법: 텍스트 파일을 한 번에 한 줄씩 읽기(Visual C#)
이 예제에서는 StreamReader 클래스의 ReadLine 메서드를 사용하여 텍스트 파일 내용을 한 번에 한 줄씩 문자열로 읽어옵니다. 각 텍스트 줄은 line 문자열에 저장되고 화면에 표시됩니다.
예제
int counter = 0;
string line;
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader(@"c:\test.txt");
while((line = file.ReadLine()) != null)
{
System.Console.WriteLine (line);
counter++;
}
file.Close();
System.Console.WriteLine("There were {0} lines.", counter);
// Suspend the screen.
System.Console.ReadLine();
[출처] https://docs.microsoft.com/ko-kr/dotnet/csharp/programming-guide/file-system/how-to-read-a-text-file-one-line-at-a-time
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 7 |
[윈도우즈 앱 개발]CaptureManager SDK - Capturing, Recording and Streaming Video and Audio from Web-Cams
| 졸리운_곰 | 2021.04.13 | 264 |
| 6 |
Window 7 Enterprise 64bit에 vb6 (visual studio 6.0 ent버젼) 설치
| 졸리운_곰 | 2018.12.04 | 529 |
| 5 |
[VS2008] 코드 난독화 (Dotfuscator Community Edition 사용)
| 졸리운_곰 | 2017.07.01 | 612 |
| 4 | GUID를 문자열로... 문자열을 GUID로 | 가을의곰 | 2017.06.10 | 293 |
| 3 |
Hooking 이란?
| 졸리운_곰 | 2015.06.16 | 525 |
| 2 |
윈도우즈 후킹 기초
| 졸리운_곰 | 2015.06.16 | 318 |
| 1 |
윈도우 메시지 후킹
| 졸리운_곰 | 2015.06.16 | 2284 |

