Contents

Views 14997 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
337 Develop [ios] Using protobuf(Protocol Buffers) on iPhone (iOS) file hooni 2014.03.20 7863
336 Develop [c] 웅지학원 NAT를 소스코드로.. file hooni 2013.04.23 7848
335 Develop [c++] 프리렉(freelec) 예제 자료.. ㅋㄷ file hooni 2013.04.23 7830
334 Develop [php] 정규표현식 간단히 정리 hooni 2013.04.23 7819
333 Develop [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거) hooni 2013.04.23 7816
332 Develop [js] 수명체크 프로그램 ㅋㅋ file hooni 2013.04.23 7815
331 Develop [js] 점점 커지는 새창.. hooni 2003.04.23 7814
330 Develop [js] 큐 형식으로 배열사용.. ㅋㅋ hooni 2013.04.23 7766
329 Develop [c] openssl 샘플코드.. 어려움 ㅠㅠ file hooni 2013.04.23 7759
328 Develop [c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ file hooni 2013.04.23 7748
327 Develop [c++] 헤더, 소스 파일 분리해서 작성해본 테스트 소스 file hooni 2013.04.23 7736
326 Develop [c#]뉴 툴바 개인적으로 만든거.. (new) secret hooni 2013.04.23 7724
Board Pagination Prev 1 ... 66 67 68 69 70 71 72 73 74 75 ... 99 Next
/ 99