Views 13521 Votes 0 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
309 System/OS [linux] 아파치설치/설정(모니터링) hooni 2003.04.23 14153
308 System/OS [linux] ssh에서 원격 파일 전송하기.. hooni 2013.04.23 14155
307 System/OS [linux] ipchains 사용예(패킷 필터링) hooni 2003.04.23 14171
306 Develop [C] C언어의 조건 연산자(Conditional Operator) hooni 2003.04.23 14227
305 Develop [c] 64bit 머신에서 inet_ntoa() 사용시 Segment fault 대처 방법법 hooni 2014.02.08 14230
304 Develop [c] vc++ 에서 clrscr(), gotoxy() 함수 사용하기.. hooni 2013.04.23 14254
303 Develop [c] 메시지큐(Message Queue) 설명.. (joinc) hooni 2013.04.23 14271
302 System/OS [linux] 기본 명령어 (내공쌓기) hooni 2003.04.23 14333
301 System/OS [linux] 아파치설치/설정 hooni 2003.04.23 14492
300 System/OS [doc] 네트워크 장비와 라우터 설정 방법 발표 자료 file hooni 2013.04.23 14493
299 Develop [ios] iOS In App Purchase #1 (코드 구현 전 웹 설정 작업) file hooni 2013.11.20 14508
298 Develop [ios] Objective-C에서 SQLite 사용하기.. file hooni 2013.04.23 14556
297 System/OS [mac] SVN 1.8 업데이트 방법 hooni 2013.09.24 14559
296 System/OS [linux] 아파치설치/설정(CGI부분) hooni 2003.04.23 14568
295 System/OS [linux] sendmail 설정/사용 hooni 2003.04.23 14570
294 System/OS [linux] 리눅스 활용 팁^^ hooni 2003.04.23 14629
Board Pagination Prev 1 ... 53 54 55 56 57 ... 74 Next
/ 74