Contents

조회 수 29525 댓글 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. [lego] 세그웨이 이것만 볼것.. ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views36852
    Read More
  2. [sql] 조회구문(select)에서 중복 데이터를 한 번만 출력 (distinct)

    Date2013.04.23 CategorySystem/OS Byhooni Views35652
    Read More
  3. [mac] 맥에서 슬립(잠자기) 모드 진입을 막는 방법~

    Date2013.10.10 CategorySystem/OS Byhooni Views35290
    Read More
  4. 베지어 곡선(Bézier curve) 알고리즘(spline 곡선)

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

    Date2013.04.23 CategoryDevelop Byhooni Views34994
    Read More
  6. Mac OS X - Apache+PHP+MySQL 환경 서버

    Date2013.04.25 CategorySystem/OS Byhooni Views34817
    Read More
  7. [js] 웹페이지에서 특정 엘리먼트 드래그, 복사, 컨텍스트메뉴, 키보드 막기

    Date2013.11.04 CategoryDevelop Byhooni Views34800
    Read More
  8. [c] C로 구현한 CGI - 방명록

    Date2003.04.23 CategoryDevelop Byhooni Views34481
    Read More
  9. [js] jQuery 코드 작성시 편리한 HTML 템플릿

    Date2013.12.17 CategoryDevelop Byhooni Views34239
    Read More
  10. [android] 디바이스(시뮬레이터) hosts 파일 수정하기

    Date2013.04.23 CategoryDevelop Byhooni Views33732
    Read More
  11. [c] C로 구현한 CGI - 달력과 날짜계산기

    Date2003.04.23 CategoryDevelop Byhooni Views33603
    Read More
  12. [ios] 디렉토리 하하하..

    Date2013.04.23 CategoryDevelop Byhooni Views33520
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 99 Next
/ 99