Contents

조회 수 29518 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
텍스트 한줄 읽기
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. [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문)

    Date2003.04.23 CategorySystem/OS Byhooni Views13776
    Read More
  2. [linux] Proftpd 설치 가이드

    Date2003.04.23 CategorySystem/OS Byhooni Views13845
    Read More
  3. [js] AngularJS를 소개합니다.

    Date2014.01.06 CategoryDevelop Byhooni Views13845
    Read More
  4. [linux] 아파치 설치/설정(proxy)

    Date2003.04.23 CategorySystem/OS Byhooni Views13849
    Read More
  5. [linux] 콘솔 기본언어 설정 방법

    Date2013.04.23 CategorySystem/OS Byhooni Views13849
    Read More
  6. [php] 심플한 게시판 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views13860
    Read More
  7. [c++] 자료구조(링크리스트,스택,큐)와 후위 표기 계산기 샘플 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views13891
    Read More
  8. 선과 악에 대한 영어논술문항(지킬앤하이드 독서 후 이어지는 심화 수행평가)

    Date2013.12.04 CategoryEtc Byhooni Views13904
    Read More
  9. [linux] 아파치설치/설정 - SSI(Server Side Include)

    Date2003.04.23 CategorySystem/OS Byhooni Views13940
    Read More
  10. [c] 다중연결 서버 만들기 #1 - fork() 사용

    Date2013.04.23 CategoryDevelop Byhooni Views13944
    Read More
  11. [linux] ProFTPD 타임아웃 설정

    Date2003.04.23 CategorySystem/OS Byhooni Views13950
    Read More
  12. [linux] ipfwadm를 이용한 패킷필터링(구버전)

    Date2003.04.23 CategorySystem/OS Byhooni Views13950
    Read More
Board Pagination Prev 1 ... 63 64 65 66 67 68 69 70 71 72 ... 99 Next
/ 99