Contents

조회 수 28535 댓글 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;


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
789 Develop [java] Sieve of Eratosthenes (에라토스테네스의 체) hooni 2013.04.23 9339
788 Database [sql] 간단한 통계 서브쿼리 예제.. hooni 2013.04.23 15090
787 Develop [js] 사진첩에 쓸 내용 - 마우스 오버로 바꾸기 hooni 2013.04.23 6340
786 Develop [js] 폼(form) 전송시 중복 클릭 방지 간단한 구문 hooni 2013.04.23 9318
785 Etc GSM에서 음성이 실리는 과정 요약.. hooni 2013.04.23 17520
784 Develop [ajax] 샘플 코드와 한글처리에 대한 간단한 설명 hooni 2013.04.23 6844
783 PPT [doc] 정보보호학술대회 논문지 ㅋㅋ file hooni 2013.04.23 12180
782 Develop [c] 전위 표기법으로 연산 예제.. file hooni 2013.04.23 9306
781 Develop [c] 프로그램 코드(c/c++)를 html 파일로 변환 file hooni 2013.04.23 7679
780 Develop [c] 구조체 배열 예제 (학생 성적 계산) file hooni 2013.04.23 7669
779 Develop [c] 숫자 맞추는 게임.. file hooni 2013.04.23 6934
778 Develop [js] php의 number_format() 함수와 같은.. ㅋㅋ hooni 2013.04.23 6937
Board Pagination Prev 1 ... 28 29 30 31 32 33 34 35 36 37 ... 98 Next
/ 98