MFC 파일입출력(TEXT파일 읽어와서 출력하기) 결과가 이상하네요
연와인
2023.04.01
void ctestanidlg::onbnclickedbtnsload() //버튼이 클릭되면 파일을 읽어와 메세지 창에 뿌려줌{// todo: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
int buffer[10];cstring str, tmp;cfile file; file.open(_t(tempscore.txt), cfile::moderead); file.read(buffer, 10 * sizeof(int)); for ( int i=0 ; i10 ; i++ ) {tmp.format(_t(%d), buffer[i]); str += tmp + _t( ); }file.close(); afxmessagebox(str);
}
tempscore.txt파일의 내용-1 2 3 4 5 6 7 8 9 10
하지만 결과!!!
제 생각에는 어딘가의 메모리 주소 10개를 읽어오는거 같은데 ㅡ.,ㅡ 아 뭐가 잘못된건지 모르겠네요..