dimanche 29 juillet 2018

C++ zenity doesn't work properly

I'm trying to draw a graph with OGDF library using the FMMM algorithm. I want to allow the choice of the input and output gml file. I tried to do this with:

FILE *in;
if (!(in = popen("zenity  --title=\"Select a gml file\" --file- 
    selection","r"))) {
     return 1;
}
char buff[512];
string selectFile = "";
while (fgets(buff, sizeof(buff), in) != NULL) {
    selectFile += buff;
}
pclose(in);

FILE *out;
if (!(out = popen("zenity --file-selection --save --confirm- 
    overwrite","w"))) {
        return 1;
}
selectFile="";
while (fgets(buff, sizeof(buff), in) != NULL) {
    selectFile += buff;
}
pclose(out);

When I run this, it opens the zenity processes but for both shows the following:

enter image description here

Can someone explain where I'm wrong? Thank you

Aucun commentaire:

Enregistrer un commentaire