Contents

Views 13525 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
729 Develop [c] 심심해서.. fseek() 예제.. file hooni 2003.04.23 7227
728 Develop [jsp] 초간단한 include 구문 예제.. file hooni 2013.04.23 7227
727 Develop [html] 메타태그 사용예.. 은지나 바라~ hooni 2003.04.23 7232
726 Develop [c] 단기과정[01/15] 피보나치, 파스칼.. 링크리스트 file hooni 2003.04.23 7234
725 Develop [c++] mfc로 만든 인테리어 수납 시스템(2D기반 설계) file hooni 2013.04.23 7234
724 Develop [c] 패킷정보출력(경로, 패킷길이, 3hand, sync, ack..) file hooni 2003.04.23 7246
723 Develop [linux] crond 사용법.. ㅋㅋ hooni 2013.04.23 7246
722 Develop [c] 단기과정[01/08] 과제.. 파스칼 삼각형 file hooni 2003.04.23 7256
721 Develop [php] 논문 관리 프로그램.. ㅋㅋ file hooni 2013.04.23 7259
720 Develop [c] 무선 Radius Server 자료.. file hooni 2013.04.23 7261
719 Develop [c++] mfc로 만든 부엌 수납 시스템(2D기반 설계) file hooni 2013.04.23 7264
718 Develop [chm] Programming Applications for Microsoft Windows file hooni 2013.04.23 7271
Board Pagination Prev 1 ... 33 34 35 36 37 38 39 40 41 42 ... 98 Next
/ 98