공룡호가 사는 세상 이야기

Prototype
FILE *fopen(
  const char *filename,
  const char *mode
);
FILE *_wfopen(
  const wchar_t *filename,
  const wchar_t *mode
);

Parameters
filename -> Filename.
mode -> Type of access permitted.

Return Value
Each of these functions returns a pointer to the open file. A null pointer value indicates an error.

Remarks
The fopen function opens the file specified by filename.
_wfopen is a wide-character version of fopen;
the arguments to _wfopen are wide-character strings.
_wfopen and fopen behave identically otherwise.

제발 그만 좀 까먹자.. 진짜 .. 이젠 막 짜증난다. open mode를 잘못 설정하는 바람에 오늘도 3시간 삽질.
더욱 자세한 것은 MSDN 참조.

The character string mode specifies the type of access requested for the file, as follows:
"r"
Opens for reading. If the file does not exist or cannot be found, the fopen call fails.
"w"
Opens an empty file for writing. If the given file exists, its contents are destroyed.
"a"
Opens for writing at the end of the file (appending) without removing the EOF marker before writing new data to the file; creates the file first if it doesn't exist.
"r+"
Opens for both reading and writing. (The file must exist.)
"w+"
Opens an empty file for both reading and writing. If the given file exists, its contents are destroyed.
"a+"
Opens for reading and appending; the appending operation includes the removal of the EOF marker before new data is written to the file and the EOF marker is restored after writing is complete; creates the file first if it doesn't exist.

'프로그래밍' 카테고리의 다른 글

습관  (0) 2006.06.06
printf() flags  (0) 2006.05.23
Data of Decision Tree (GPS)  (0) 2006.05.03
Windows Prog. DataType  (3) 2006.03.28
널문자가 존재하는 이유  (0) 2006.03.07