selectOutput()

Output / Files

Description

Opens a file chooser dialog to select an output file. Returns the path.

Syntax

std::string selectOutput(std::string prompt, std::string filter)

Parameters

NameTypeDescription
promptstd::stringdialog message
filterstd::stringfile extension filter (optional)

Returns

std::string

Related

Under the Hood

From Processing.h:

static std::string selectOutput(const std::string& prompt="", const std::string& filter="");

Under the Hood

From Processing.cpp:

std::string PApplet::selectOutput(const std::string& prompt,const std::string&){ std::string cmd="zenity --file-selection --save --title=\""+prompt+"\" 2>/dev/null"; FILE* p=popen(cmd.c_str(),"r"); if(!p)return ""; char buf[4096]=""; fgets(buf,sizeof(buf),p); pclose(p); std::string r(buf); if(!r.empty()&&r.back()=='\n')r.pop_back(); return r; }