Created
February 24, 2026 01:02
-
-
Save bg1bgst333/0fc0f096450334ac7e87655961af61ca to your computer and use it in GitHub Desktop.
fopen#return_value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ヘッダファイルのインクルード */ | |
| #include <stdio.h> /* 標準入出力 */ | |
| /* main関数の定義 */ | |
| int main(void){ | |
| /* ポインタの宣言 */ | |
| FILE *fp; | |
| /* ファイルを開く. */ | |
| fp = fopen("test.txt", "r"); | |
| if (fp == NULL){ | |
| return 1; | |
| } | |
| /* FILE構造体のポインタを取得出来たので, FILE構造体のメンバ_flagsの_IO_EOF_SEENの部分を出力してみる. */ | |
| printf("(fp->_flags & _IO_EOF_SEEN) >> 4 = %x\n", (fp->_flags & _IO_EOF_SEEN) >> 4); | |
| /* ファイルを閉じる. */ | |
| fclose(fp); | |
| /* プログラムの終了 */ | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment