fopen ライブラリ関数

ファイルを開く

FILE *fopen( const char *filename, const char *mode );

指定したストリームを閉じる

int fclose( FILE *stream );

サンプルです。

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main()
{
        FILE *fp;

        if( (fp  = fopen( "test.txt", "r" )) == NULL ){
                printf( "fopen関数失敗\n" );
                exit(1);
        }else{
                printf( "fopen関数成功\n" );
        }

        fclose( fp );

        getch();

        return 0;
}

トップページ