Views 28527 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;

?

List of Articles
No. Category Subject Author Date Views
581 Develop [js] 이미지 사이즈를 동적으로 조절.. hooni 2013.04.23 7473
580 Develop [c++] 가짜 인증서(하나은행) 프로그램 file hooni 2013.04.23 10760
579 Develop [c++] 디렉토리 내의 파일 찾기 FindFirstFile() 함수 6 hooni 2013.04.23 20583
578 Develop [c++] 웹폼(webform)전송과 http 파일 업로드 샘플 file hooni 2013.04.23 33076
577 Develop [doc] 유료 방송 제어 시스템 (CAS) 발표자료 file hooni 2013.04.23 8507
576 Develop [doc] 테크니컬 레포트 (BHO 취약점을 이용한 공격) 2 file hooni 2013.04.23 27080
575 Develop OPT와 CAS에 대한 자료.. (교수님 메일로 보내드린 자료..) file hooni 2013.04.23 13923
574 Etc 스파이웨어(BHO) 탐지하는 방법.. hooni 2013.04.23 44409
573 PPT [ppt] 시스템보안 연구실 ppt 템플릿.. (CIST) file hooni 2013.04.23 20869
572 Develop [c++] BHO 프로그램 동작 원리.. 간단하게.. hooni 2013.04.23 43102
571 Develop [c++] 현승이가 준 P2P 프로그램 소스 ㅋㅋ file hooni 2013.04.23 12070
570 PPT [ppt] 뚜레쥬르 온라인 마케팅 제안서 file hooni 2013.04.23 23496
569 Develop [php] 심플한 게시판 ㅋㅋ 1 file hooni 2013.04.23 12991
568 System/OS [windows] 최근 열어본 문서목록 안나오게 하는 방법 hooni 2013.04.23 25483
567 Develop [jsp] RSS(xml) 파싱해서 보여주기 ㅎㅎ file hooni 2013.04.23 13213
566 Develop [php] 한샘 전자발주 시스템.. file hooni 2013.04.23 11985
Board Pagination Prev 1 ... 36 37 38 39 40 ... 74 Next
/ 74