Contents

조회 수 28582 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
405 Develop [php] whois정보 조회 프로그램 hooni 2003.04.23 11769
404 Develop [php] 배열 관련 함수 설명 ㅎㅎ hooni 2003.04.23 11775
403 Develop [ios] iOS In App Purchase 코드 부분 샘플 1 hooni 2013.11.20 11788
402 Develop [c++] 기초강좌 #04(클래스) hooni 2003.04.23 11858
401 Develop JSON, BSON 변환 file hooni 2013.04.23 11859
400 Develop [java] 날짜 계산 (Date, SimpleDateFormat) hooni 2013.04.23 11862
399 System/OS [linux] 텔넷, FTP 텍스트 모드에서 사용 hooni 2003.04.23 11987
398 Develop [php] 한샘 전자발주 시스템.. file hooni 2013.04.23 12014
397 System/OS [unix] SUN Solaris 싱글모드.. ㅡ,.ㅡ; hooni 2003.04.23 12047
396 Develop [c++] 현승이가 준 P2P 프로그램 소스 ㅋㅋ file hooni 2013.04.23 12090
395 System/OS [linux] 쉘 스크립트 (Shell Script) hooni 2003.04.23 12107
394 PPT [ppt] Magic URLs & Hidden Form Fields 에 대해.. ㅋㅋ file hooni 2013.04.23 12110
Board Pagination Prev 1 ... 60 61 62 63 64 65 66 67 68 69 ... 98 Next
/ 98