[C]fopen의 a+ 모드

개발/프로그래밍2007. 11. 15. 08:30
728x90

file position 위치를 알기 위해서 man page를 열어보니

다음과 같이 있어서
fopne에서 a+모드로 설정할 경우 파일의 마지막을


가르킨다. 간단히 풀리는 듯 했다.
 

a+     Open for reading and appending (writing at end of file).  The file is created if it does not exist.  The  stream  is  positioned at the end of the file.

 

그러나 자꾸만 0이 나왔다.

무언가 잘못 했나 생각하고 다른 소스는 지우가 달랑
 

이렇게 테스트했다.

 

사용자 삽입 이미지

그래도 0이다. 이리저리 방황하다가 좀 더 최신의 man page를 확인

a+

Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file.

 

..ㅠㅠ 새로 바뀐 듯 하였다. 아님 GCC 버전에 따라 조금 다른 듯 하였다.
 

오늘도 여김없이 삽질의 연속이다.

728x90

작성자

Posted by 일퍼센트

관련 글

댓글 영역