Contents

Views 13564 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
데이터 쓰기
: 배열 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); 
}


?

List of Articles
No. Category Subject Author Date Views
333 Develop [c] 기본 자료형(int)이 표현할 수 없는 큰 수(Big number)를 덧셈하는 코드. 1 hooni 2013.04.23 13488
332 System/OS [linux] 프로그램 설치방법 (내공쌓기) hooni 2003.04.23 13498
331 Algorithm 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. file hooni 2013.04.23 13498
330 System/OS [ms-sql] 프로시져 예제.. file hooni 2013.04.23 13507
329 System/OS [linux] Xwindow/Xmanager 사용 hooni 2003.04.23 13516
328 System/OS [linux] 기존 환경설정 저장하면서 커널 컴파일.. hooni 2003.04.23 13538
327 System/OS [linux] 간단한 vi편집기 사용 명령 hooni 2003.04.23 13540
» Develop [c++] mfc 간단한 파일 입출력 예제 hooni 2013.04.23 13564
325 System/OS [linux] 쉘 환경변수 PS1(프롬프트) hooni 2003.04.23 13567
324 Develop [js] 자바스크립트를 동적으로 로딩하기 hooni 2013.04.23 13616
323 Develop [js] window.open() 속성 사용 방법 hooni 2013.11.18 13640
322 Develop [iphone] 아이폰 어플 모음 ㅋㅋ secret hooni 2013.04.23 13707
Board Pagination Prev 1 ... 66 67 68 69 70 71 72 73 74 75 ... 98 Next
/ 98