Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はコーディングにパテを使用しているので、私の質問は一般的な範囲ですが、そのプログラムの観点から尋ねられます。
コマンド ラインからファイルを取得し、それを 1 行ずつメイン プログラムに読み込み、分割して関数で操作できるようにするにはどうすればよいでしょうか。fstream クラスを使用していることは理解していますが、実際にファイルから行を読み取るための正しい手順がわかりません
これは簡単なサンプルです:
ifstream in("file.txt"); if (!in.is_open()) { cout << "Error - cannot open the file." << endl; return 0; } string line; while (getline(in, line)) { cout << line << endl; ... }