結果

問題 No.3010 Print inside /bin
ユーザー nola_suznola_suz
提出日時 2015-05-03 23:48:12
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 879 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 55,456 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-19 05:33:40
合計ジャッジ時間 1,053 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
using namespace std;

int main(){
    char outfile[] = "file.txt";  //読み込むファイルの指定
     
    ifstream fin( outfile, ios::in | ios::binary );
    //  ファイルを開く
    //  ios::in は読み込み専用  ios::binary はバイナリ形式

    
    if (!fin){
        cout << "ファイル file.txt が開けません";
        return 1;
    }
    //  ファイルが開けなかったときの対策
    
    // double d;  //文字列ではないデータ
    string s;
    while(getline(fin,s)){
    	cout<<s<<endl;
    }
    // while(!fin.eof()){  //ファイルの最後まで続ける
        // fin.read( ( char * ) &d, sizeof( double ) );
          //文字列ではないデータを読みこむ
        // cout << d << endl; 
    // }
    
    fin.close();  //ファイルを閉じる
    
    return 0;
}
0