Develop
2013.04.23 15:40
[c++] mfc 간단한 파일 입출력 예제
조회 수 13529 댓글 0
데이터 쓰기
: 배열 1~100 까지 내용을 저장하고 그 값을 파일(FILE.DAT)로 출력함
void CFileExView::OnFilesave() { int buffer[100]; for ( int i=0 ; i<100 ; i++ ) buffer[i] = i+1; CFile file; file.Open(_T("FILE.DAT"), CFile::modeCreate | CFile::modeWrite); file.Write(buffer, 100 * sizeof(int)); file.Close(); }
데이터 읽기
: FILE.DAT 에서 데이터를 읽어와서 배열에 값을 저장하고 메시지 박스에 값을 출력함
void CFileExView::OnFileload() { int buffer[100]; CString str, tmp; CFile file; file.Open(_T("FILE.DAT"), CFile::modeRead); file.Read(buffer, 100 * sizeof(int)); file.Close(); for ( int i=0 ; i<100 ; i++ ) { tmp.Format("%d", buffer[i]); str += tmp + " "; } AfxMessageBox(str); }
-
[c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ
-
[c] 분수계산 함수^^
-
[c] 베지어 곡선(Bézier curve) 알고리즘
-
[c] 베이지언(Bayesian) 패턴인식 과제 ㅋㅋ
-
[c] 반올림 함수!! ㅋㅋ
-
[c] 바로 보고 정리할 것.. ㅋㄷㅋㄷ
-
[c] 민수형 소스(도메인소켓포함)
-
[c] 민수형 libipq 샘플 소스 ㅋㅋ
-
[c] 문자열 컨트롤 함수로 만든 프로그램들..
-
[c] 문자열 치환해주는 str_replace() 함수
-
[c] 문자열 처리(문자열 자르기)
-
[c] 문자열 처리 관련 함수들 설명