selectOutput()
Output / FilesDescription
Opens a file chooser dialog to select an output file. Returns the path.
Syntax
std::string selectOutput(std::string prompt, std::string filter)
Parameters
| Name | Type | Description |
|---|---|---|
| prompt | std::string | dialog message |
| filter | std::string | file extension filter (optional) |
Returns
std::stringRelated
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;
}