hi
hope anyone who reads this post is doing well/will be doing well soon enough :) ...
i have a small problem... i have a program in c/c++ (i am using just a few functions of c++) which creates a log of files after doing some search(its not relavent to the question )...called files.txt... and then creates symbolic links for the files in the files.txt in a folder called results...

currently i am printing a statement which says..."please open results folder to view files found."...

i want to know is there a way by which i can open the result folder from the program i.e. result folder in a window with files/links to files as icon ...
I am using linux os... i can use c/c++ if c doesn't support the solution...

ok i don't know how that code works but anyhow your solution did gave me an idea..which was to post this question on some linux forum... i did get the reply ....for that and the solution is only one line just execute the command on linux shell e.g.
system("konqueror /path/foldername");
for interest of the reader here is the link

http://www.linuxforums.org/forum/misc/101818-how-open-folder-graphical-mode-window-using-linux-shell.html#post501287


p.s. i am not saying your solution is bad(i don't think it is the solution i was looking for i mean the code snippet isn't) i am just trying to help anyone else who might view this post...

i think this solution is not too complex and easy to understand for people who are newbies like me and are only need it work on KDE...

i don't mean to offend you dragon if i did i am very sorry...

I don't know what this "opening a folder" exactly supposed to mean, but one thing which is usually always available, no matter what desktop you use, is xterm. This opens xterm in the directory /pathname/foldername and prints the directory contents:

system ("xterm -e 'cd /pathname/foldername && ls && bash'");

Then you can do everything with the files in that directory.

i don't mean to offend you dragon if i did i am very sorry...

No offense taken and no need for apology. The solution I posted will get you all the files in the directory and all sub-directories and puts the file names in a std::vector. Might be a little too complicated for new programmers though.

hey ancient sorry for not replying it did get it solve eventually... with a bit of editing...

HI I THINK I GOT YOUR PROBLEM SOLVED.

YOU CAN USE THE BELOW PROGRAM TO DISPLAY THE CONTENTS OF FOLDER IN AN ARRAY.

THIS WORKS IN LINUX

#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

/*function... might want it in some class?*/
int getdir (string dir, vector<string> &files)
{
    DIR *dp;
    struct dirent *dirp;
    if((dp  = opendir(dir.c_str())) == NULL) {
        cout << "Error(" << errno << ") opening " << dir << endl;
        return errno;
    }

    while ((dirp = readdir(dp)) != NULL) {
        files.push_back(string(dirp->d_name));
    }
    closedir(dp);
    return 0;
}

int main()
{
    string dir = string(".");
    vector<string> files = vector<string>();

    getdir(dir,files);

    for (unsigned int i = 0;i < files.size();i++) {
        cout << files[i] << endl;
    }
    return 0;
}
This question has already been answered. Start a new discussion instead.