LoginSignup
6
5

More than 5 years have passed since last update.

スパッと空のファイルを作成する

Last updated at Posted at 2016-01-20

スパッとつくりたいとき専用。

  • コメントでコンストラクタを使用するとワンライナーで書けるとのことで改訂しました。

改訂版

#include <fstream>

// 一時変数もつくらないので最速っぽい。
std::ofstream(path_to_file);

みじかい!よい!

初回版

#include <fstream>

std::ofstream strm;
strm.open(path_to_file);
strm.close();
6
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5