selectInput()
Input / FilesDescription
Opens a file chooser dialog to select an input file. Returns the selected path.
Syntax
std::string selectInput(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 selectInput(const std::string& prompt="", const std::string& filter="");
Under the Hood
From Processing.cpp:
std::string PApplet::selectInput(const std::string& prompt,const std::string&){
std::string cmd="zenity --file-selection --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;
}