Search for a file

This is a discussion on Search for a file within the C Programming forums, part of the General Programming Boards category; Hi, I want to write code that search for a specific file under the root directory all drives. I ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    130

    Search for a file

    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

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    You mean like what's in the FAQ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    130
    What do you mean?

    I need some hints no more

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    You mean like the FAQ titled
    "Accessing a directory and all the files within it"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    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...

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    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
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  2. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21