Hi,
I want to write code that search for a specific file under the root directory – all drives.
I want all ways to do that; using commands within the code or without
Thankx
Printable View
Hi,
I want to write code that search for a specific file under the root directory – all drives.
I want all ways to do that; using commands within the code or without
Thankx
You mean like what's in the FAQ?
What do you mean?
I need some hints no more
You mean like the FAQ titled
"Accessing a directory and all the files within it"
all ways?? here's one way I know..see if it helps:
there's a function called "system()" .check the man pages.THis allows u to execute shell scripts from within ur C program....Keep in mind that U need to escape characters like double quotes when passing the arguments to this function..
So, the shell script that does the searching job will be the argument to this function.
I hope u r using linux...
If u find it difficult to use this directly, u can write a shell program that does the job u want and call theshell programfrom ur C program using the same system() call...
Then the question becomes, "How do I do that in my shell script?" :)
Here is the FAQ: FAQ > How do I... (Level 3) > Accessing a directory and all the files within it
If you really want to execute a shell script to do the work for you, read this FAQ: FAQ > How do I... (Level 2) > Run a program from within a program