コンテンツへスキップ

mowareのブログ 3rd

気ままなホビープログラマのITブログです。ハードやソフトに関するTIPSを扱っています。

  • ホーム
  • プログラミング
  • Mac
  • Xcode
  • Linux
  • Windows
  • パソコン
  • 電子工作
  • DTM
  • Favorite
  • メインブログ
  • サブブログ

最近の投稿

  • Excel for Mac 2018とWord for Mac 2024の共存
  • VPN設定 FortiClient macOS 2025年1月
  • Mac mini M2 Pro 動作不良対応
  • 画像加工アプリ類の使い分け 2024年12月
  • [GIMP] 01 UIが理解不能のためPython2で描く / フォント画像作成

カレンダー

2022年9月
日 月 火 水 木 金 土
 123
45678910
11121314151617
18192021222324
252627282930  
« 8月   10月 »

月別アーカイブ

日: 2022年9月16日

[C++] テキストファイルから1行を文字列として取得

#include <fstream>
#include <iostream>
#include <string>

std::ifstream inputfile;
string file = "test.txt";
string buffer;

inputfile.open(file, std::ios::in);
std::getline(inputfile, buffer);

--------------------------------------------------
// 複数行の場合
while(std::getline(inputfile, buffer)){
        std::cout << buffer << std::endl;
}
投稿日: 2022年9月16日2022年9月16日カテゴリー プログラミング
Proudly powered by WordPress