여기는 저의 2004~2007년까지의 기록입니다. 이 블로그는 이제 Tistory로 옮겼습니다.
2008년부터의 기록은 http://blog.studioego.info 로 가시기 바랍니다.

StudioEgo's Thoughts, seasonⅡ


C++ 파일 입출력
#include
#include

using std::cout;
using std::endl;
using std::cin;
using std::fstream;
using std::ofstream;
using std::ifstream;
using std::ios;
int main(void)
{
ifstream in; // 입력 스트림
ofstream out; // 출력 스트림
char cr[20];

in.open("input.txt"); // 파일열기
if(!in)
{
cout<<"error#1 : Not input file open!"< return 1;
}

in >> cr; // 읽어서 cr에 넣음

out.open("output.out");//파일생성됨
if(!out)
{
cout<<"error#2 : Not output file open!"< return 1;
}


for(int j=0; j<10; j++) //파일출력
{
out << cr[j]<<" ";
}


in.close(); // 열었으니 닫아줌.
out.close();

return 0;
}
by Ego君 | 2006/06/06 17:38 | 컴퓨터 | 트랙백 | 덧글(1)
트랙백 주소 : http://sungdh86.egloos.com/tb/2473270
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by JANE at 2006/06/06 21:31
거의 반년만에 보는 파일 입출력 코드네요. (...); 요즘은 디바이스 드라이버 소스들만 보다보니...;;

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >