ディスク入出力

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

int main(int argc, char *argv[])
{
    if(argc!=2){
        cout << "use: WRITE\n";
        
        return 1;
    }
    ofstream out(argv[1]);
    
    if(!out){
        cout << "cannot open input file\n";
        return 1;
    }
    
    char str[80];
    cout << "write char in disk and stop $\n";
    
    do {
        cout << ": ";
        cin >> str;
        out << str << endl;
    } while (*str != '$');
    
    out.close();
    return 0;
}