티스토리 뷰
//File 객체를 이용한 텍스트 파일 읽고 쓰기
string strContent = File.ReadAllText(path);
File.WriteAllText(path, strContent);
// Stream을 이용한 텍스트 파일 읽고 쓰기
// StreamReader reader = new StreamReader(itemFile.FullPath, Encoding.GetEncoding("euc-kr")); // 한글 깨짐 방지
StreamReader reader = new StreamReader(itemFile.FullPath, true);
string strContent = reader.ReadToEnd();
reader.Close();
StreamWriter writer = new StreamWriter(path);
writer.Write(strContent);
writer.Close();
출처: http://neodreamer.tistory.com/567
'응용프로그래밍 > C#' 카테고리의 다른 글
| [C#] int 로 형 변환 (0) | 2011.09.19 |
|---|---|
| DataSet 사용시 연결문자열 노출 안되게 (0) | 2011.09.18 |
| C# MSSQL 접속 (0) | 2011.09.15 |
| Debug 창에 나타내려면 (0) | 2010.12.08 |
| [C#] 프로세스와 CPU 사용량 모니터링 및 Kill (0) | 2009.03.05 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 안드로이드
- iis
- JQuery
- PHP
- API
- classic asp
- IOS
- nginx
- macos
- IE
- 워드프레스
- mssql
- git
- CSS
- javascript
- Linux
- Android
- centos
- Docker
- Debug
- ASP
- Prototype
- JSON
- iphone
- laravel
- sencha touch
- Mac
- 한글
- Wordpress
- nodejs
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함