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); 
}

?

  1. [c++] p.118 확인학습 5번

  2. [c++] p.47 연습문제 3번

  3. [c++] p.58 연습문제 2번

  4. [c++] RSA Sample 4 CPP

  5. [c++] SetWindowPos함수를 이용한 크기조절 예제

  6. [c++] String Tokenizer (나중에 c 코드로 변경해서 사용할 것)

  7. [c++] template 사용예

  8. [c++] Win32 API 기본 출력인 MessageBox() 함수 사용 예제..

  9. [c++] Win32API를 이용한 ExitWindowsEx 사용한 예제코드

  10. [c++] Window API(MFC) 오목 게임

  11. [c++] WinSock2.0 채팅 프로그램 ㅋㅋ

  12. [c++] winsock을 이용한 서버,클라이언트와 ssl서버,클라이언트

  13. [c++] 가짜 인증서(하나은행) 프로그램

  14. [c++] 기초강좌 #01(입출력,영역지정)

  15. [c++] 기초강좌 #02(레퍼런스,메모리할당)

  16. [c++] 기초강좌 #03(함수의 매개변수 전달)

Board Pagination Prev 1 ... 6 7 8 9 10 ... 53 Next
/ 53