[C#] 파일읽기, 저장, 삭제
프로그래밍시 많이 사용하는 구문중 하나인, 파일 연동에 대해 소개합니다. 파일내용 읽기, 파일 저장, 파일 삭제 [C# 기준] //파일내용 읽기 System.IO.File.ReadAllText("{파일경로}", Encoding.UTF8); //파일저장 //파일이 있다면 덮어쓰기, 없다면 생성 System.IO.File.WriteAllText("{저장할 파일경로}", "{파일내용}", Encoding.UTF8); //파일이 있다면 기존내용에 추가, 없다면 생성 System.IO.File.AppendAllText("{저장할 파일경로}", "{파일내용}", Encoding.UTF8); //파일삭제 System.IO.File.Delete("{파일경로}");
2021. 2. 7.