2010-10-01 ファイル入出力系 c++ memo seekg std::ios::beg ファイルの先頭 std::ios::cur ファイルの今見ている位置 std::ios::end ファイルの最後 tellg 現在の位置を取得する ファイルの先頭では 0 を返す EOFでは -1 を返す リンク3より,EOFになったファイルディスクリプタを最初に巻戻してもう一度最初から読み込む方法を知る. ifstream fin("text"); std::fin.clear(); std::seekg(0, std::ios::beg); 参考 C++入出力 http://www.geocities.jp/ky_webid/cpp/library/033.html luluciの -C++ istreamとseekgとeof istream::tellg - C++ Reference