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;


?

  1. [linux] 스케쥴링 순서(nice) 변경하기

    Date2003.04.23 CategorySystem/OS Byhooni Views12545
    Read More
  2. [doc] 피쳐셀렉션(feature selection using..) 발표 자료

    Date2013.04.23 CategorySystem/OS Byhooni Views12548
    Read More
  3. [ppt] 네오웹 소프트.. 발표 자료 모음

    Date2003.04.23 CategoryPPT Byhooni Views12550
    Read More
  4. [sql] 간단한 SQL 문법 정리

    Date2003.04.23 CategoryDatabase Byhooni Views12554
    Read More
  5. [flash] 맘에 드는 파이차트

    Date2013.04.23 CategoryEtc Byhooni Views12590
    Read More
  6. [linux] 간단한 NAT 설정 script

    Date2003.04.23 CategorySystem/OS Byhooni Views12608
    Read More
  7. [c++] Win32 API 기본 출력인 MessageBox() 함수 사용 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views12651
    Read More
  8. [mysql] error while loading shared libraries: libmysqlclient.so.10:

    Date2003.04.23 CategoryDatabase Byhooni Views12664
    Read More
  9. [linux] root 전환시 패스워드 없이 su 사용하기

    Date2013.12.22 CategorySystem/OS Byhooni Views12688
    Read More
  10. [linux] 프로세스 상태확인(ps)

    Date2003.04.23 CategorySystem/OS Byhooni Views12713
    Read More
  11. 선과 악에 대한 영어논술문항(지킬앤하이드 독서 후 이어지는 심화 수행평가)

    Date2013.12.04 CategoryEtc Byhooni Views12749
    Read More
  12. [mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때..

    Date2003.04.23 CategoryDatabase Byhooni Views12789
    Read More
Board Pagination Prev 1 ... 63 64 65 66 67 68 69 70 71 72 ... 98 Next
/ 98