728x90
반응형
C#에서 사용가능 한 아주 간단한 txt 파일 읽기 쓰기
private void btn_Save_Click(object sender, RoutedEventArgs e)
{
string save_data = string.Format("{0},{1},{2},{3},{4},{5}", txt_X.Text, txt_Y.Text, txt_Z.Text, txt_A.Text, txt_B.Text, txt_C.Text);
System.IO.File.WriteAllText("test.txt", save_data, Encoding.ASCII);
string read = System.IO.File.ReadAllText("test.txt");
MessageBox.Show(read);
}
버튼 클릭 시 데이터가 저장되고 저장된 데이터를 읽어와 메세지창에 띄운다.
txt파일에 저장된 데이터
728x90
반응형
'.Net > C#' 카테고리의 다른 글
C# DateTime Ticks to Seconds TimeSpan 활용 사용한 시간 구하기 (0) | 2022.10.12 |
---|---|
C# WPF 다른 스레드가 이 개체를 소유하고 있어 호출 스레드가 해당 개체에 액세스할 수 없습니다. (0) | 2022.10.05 |
C# List Generic Struct/txt Save 리스트 배열 구조체 텍스트 저장 (0) | 2022.09.29 |
댓글