saveStrings()

Output / Files

Description

Writes an array of strings to a file, one per line.

Syntax

bool saveStrings(std::string path, std::vector<std::string> lines)

Parameters

NameTypeDescription
pathstd::stringpath to write to
linesstd::vectorstrings to write

Returns

bool

Related

Under the Hood

From Processing.h:

inline bool saveStrings(const std::string& path, const std::vector<std::string>& lines) { std::ofstream f(path); if (!f) return false; for (auto& l:lines) f<<l<<"\n"; return true; } static bool saveStrings(const std::string& path, const std::vector<std::string>& lines);

Under the Hood

From Processing.cpp:

bool PApplet::saveStrings(const std::string& path, const std::vector<std::string>& lines) { std::ofstream f(path); if (!f) return false; for (auto& l : lines) f << l << "\n"; return true; }