C++というよりC like な章かも
FILE *fp; fp = fopen("filename.txt", "r" ); if( fp == NULL ){ printf("File do not exist.\n"); return -1; } fclose( fp );