C언어 파일 입출력

한세희의 이미지

txt파일로 저장하고

프로그램을 다시 실행할때

저장된 txt파일에 data로 초기화 시키려면 어떻게

해야 하나요?

gamdora의 이미지

처음 실행할 때 txt 파일이 있나 확인하고 있으면 읽고

없으면 만들면 되지 않을까요?

chadr의 이미지

1.파일을 연다
2.파일을 읽는다
3.읽은 데이터를 메모리에 복사한다.
4.파일을 닫는다.

이렇게 하시면 되구요..
관련함수로는 fopen, fread, fclose 함수를 man페이지나 msdn에서 참고하시면 됩니다.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.

-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.