텍스트 파일을 한 번에 한 줄씩 읽기
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
방법: 텍스트 파일을 한 번에 한 줄씩 읽기(Visual C#)
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();'Language > C#' 카테고리의 다른 글
| An INI file handling class using C# (663) | 2015.12.10 |
|---|---|
| File Write 시에 모니터링 및 끝나면 다음 동작 수행 (6) | 2015.11.11 |
| C# mssql 접속 및 Select 예제 (6) | 2015.09.22 |
| string 을 공백문자를 구별자로 split 하고 싶을때 (4) | 2015.09.15 |
| Listview 복사(복제하기) (4) | 2015.09.11 |