Views 28515 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
텍스트 한줄 읽기
char buffer[125], *ps;
CString strName, strNum;
CString readfilename = pDlg.GetPathName();
m_readfile = readfilename;

FILE *stream = fopen(m_readfile, "rt");
if (stream == NULL) return;

while (fgets(buffer, 125, stream) != NULL) // 텍스트파일을 한줄씩 읽습니다. 
{
    ps = strchr(buffer, '\n'); // 제일 뒤쪽의 new line의 char을 찿아.
    if (ps != NULL) *ps = '\0';// new line의 char을 null문자로 바꿉니다. 

    int cn = 0;
    ps = strtok(buffer, ",");
    while (ps) {
        if (cn == 0) strName.Format("%s", ps);
        else strNum.Format("%s", ps);
        ps = strtok(NULL, ",");
        cn++;
    }
    TRACE("%s\r\n",buffer);
}

바이너리 파일 읽기
FILE *rfp,*wfp;
int c;

if((rfp = fopen(rpath,"rb"))==NULL)
    return;

if((wfp = fopen(wpath,"ab"))==NULL)
{
    fclose(rfp);
    return;
}

while(1)
{
    c = fgetc(rfp);
    if(!feof(rfp))
    {
        int a = ftell(wfp);
        fputc(c,wfp);
    }
    else
        reak;
}
fclose(rfp);
fclose(wfp);

MFC 파일 한줄씩 읽기
CStdioFile file(fileName, CFile::modeRead | CFile::typeText);

while(1)
{
    if ( !file.ReadString(str) )
        break;
}
file.Close();
return true;

?

  1. [c++] 기초강좌 #04(클래스)

    Date2003.04.23 CategoryDevelop Byhooni Views11830
    Read More
  2. [c++] 더블 링크리스트(linked list) 학습용 초간단 단어장

    Date2003.04.23 CategoryDevelop Byhooni Views9323
    Read More
  3. [c++] 데이터 압축 프로그램 소스 (lzw)

    Date2013.04.23 CategoryDevelop Byhooni Views9935
    Read More
  4. [c++] 디렉토리 내의 파일 찾기 FindFirstFile() 함수

    Date2013.04.23 CategoryDevelop Byhooni Views20571
    Read More
  5. [c++] 레지스트리 등록 예제

    Date2013.04.23 CategoryDevelop Byhooni Views8785
    Read More
  6. [c++] 레지스트리 편집하는 부분..ㅡㅡ;

    Date2013.04.23 CategoryDevelop Byhooni Views8271
    Read More
  7. [c++] 링크리스트(linked list) 클래스(스택,큐)

    Date2003.04.23 CategoryDevelop Byhooni Views9553
    Read More
  8. [c++] 마방진 소스코드

    Date2013.04.23 CategoryDevelop Byhooni Views9558
    Read More
  9. [c++] 문자열 뒤집기(문자열 거꾸로 출력)

    Date2013.04.23 CategoryDevelop Byhooni Views17281
    Read More
  10. [c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과..

    Date2013.04.23 CategoryDevelop Byhooni Views8900
    Read More
  11. [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거)

    Date2013.04.23 CategoryDevelop Byhooni Views7029
    Read More
  12. [c++] 쓰레드(Thread) 객체의 사용

    Date2013.04.23 CategoryDevelop Byhooni Views8574
    Read More
  13. [c++] 압축프로그램(Lite Zip) 샘플

    Date2013.04.23 CategoryDevelop Byhooni Views8603
    Read More
  14. [c++] 웹폼(webform)전송과 http 파일 업로드 샘플

    Date2013.04.23 CategoryDevelop Byhooni Views33068
    Read More
  15. [c++] 윈도우 API 정복 예제

    Date2013.04.23 CategoryDevelop Byhooni Views7608
    Read More
  16. [c++] 윈도우 프로세스뷰어 분석.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views8834
    Read More
Board Pagination Prev 1 ... 7 8 9 10 11 ... 53 Next
/ 53