Command EXEC/find in a C++ program file

Command EXEC/find in a C++ program file

Post by Mais » Sun, 11 Nov 2001 03:37:06



Hi,

How can I check all the files which are in a Unix folder in a C++ program ?

I want to execute a find . and receive all the result into a variable.

Thanks !!!

 
 
 

Command EXEC/find in a C++ program file

Post by j.. » Sun, 11 Nov 2001 04:01:22



> How can I check all the files which are in a Unix folder in a C++ program ?

> I want to execute a find . and receive all the result into a variable.

Look at opendir(), readdir(), closedir(). You can write a function
that reads all the files in a directory, puts them into some kind of
container, and returns the container.

 
 
 

Command EXEC/find in a C++ program file

Post by Mais » Wed, 14 Nov 2001 18:08:08


Thank you, that is exatly what I wanted !!


> > How can I check all the files which are in a Unix folder in a C++ program ?

> > I want to execute a find . and receive all the result into a variable.

> Look at opendir(), readdir(), closedir(). You can write a function
> that reads all the files in a directory, puts them into some kind of
> container, and returns the container.

 
 
 

Command EXEC/find in a C++ program file

Post by red floy » Thu, 15 Nov 2001 17:37:13


Not a flame, but if you're gonna do Unix, you should probably learn the
lingo...  "Folder" is a Windows-ism.  The preferred Unix term is
"directory".  As I said, not a flame... anyone coming over from the dark
side is welcome :-P ....


> Thank you, that is exatly what I wanted !!





> > > How can I check all the files which are in a Unix folder in a C++
program ?

> > > I want to execute a find . and receive all the result into a variable.

> > Look at opendir(), readdir(), closedir(). You can write a function
> > that reads all the files in a directory, puts them into some kind of
> > container, and returns the container.

 
 
 

1. How to exec a command in a C++ program

Hi,

my second question today ...
How can I exec a command, like "ls -l /usr" in a program ?
I'd like to little program, which looks in /usr (ls -l /usr) and
output the answer then. Can you write the code ?
Thanks a lot!!

          Dominik.

--
 ______________________________________        This Mail Is Powered By:

| WebSite: http://home.pages.de/~domix |            Linux 2.0.33
|               /* EOF */              |            ------------
|______________________________________|        

2. JVM-1.4.1_0 aborted by Kernel?

3. find -exec find -exec rm

4. Help: Enable to boot

5. Need to find vi command to remove ^H from command man find > find.txt

6. Associating acroread with PDF files

7. exec a command from c++ to get mem/time usage

8. Big Raw devices on Solaris

9. Multiple commands via -exec in find

10. java program using runtime.exec not running the command in unix like it should

11. exec $program || exec $alternative

12. error with -exec in find-command

13. Help with find: modifying {}, and multiple commands in exec