txt파일1 C# 텍스트 파일 다루기 - 쓰기 (txt 파일 생성) #region 텍스트 파일 생성 public void CreateText(int type) { string val = ""; string path = @"c:테스트_" + type + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; try { val = val + "hello1" + "\n"; val = val + "hello2" + "\n"; System.IO.File.WriteAllText(path, val, Encoding.Default); } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); return; } MessageBox.Show("생성이 완료되었.. 2019. 9. 19. 이전 1 다음 반응형