Skip to content

Instantly share code, notes, and snippets.

@bg1bgst333
Created February 24, 2026 01:02
Show Gist options
  • Select an option

  • Save bg1bgst333/0fc0f096450334ac7e87655961af61ca to your computer and use it in GitHub Desktop.

Select an option

Save bg1bgst333/0fc0f096450334ac7e87655961af61ca to your computer and use it in GitHub Desktop.
fopen#return_value
/* ヘッダファイルのインクルード */
#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