Built in Searching functions

This is a discussion on Built in Searching functions within the C Programming forums, part of the General Programming Boards category; Does C have any built in searching functions for files? If so where can I get some info on this. ...

  1. #1
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198

    Built in Searching functions

    Does C have any built in searching functions for files?

    If so where can I get some info on this.

    Thanks
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    no, you have to write them yourself, if im not mistaken, the lowlevel file functions such as, open(), work on opening diretories etc...

    the headers depend on the compiler,

    try stdio.h, fcntl.h, unistd.h, ect...

    im pretty sure for searching you have to go to the OS.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >opendir / readdir / closedir are the POSIX API calls you should be using for navigating the file system

    hah, thats right, been a long time.
    sorry, for my stupid mistake.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    The FAQ has a couple of examples.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006

    RE: The FAQ

    I tried to build the first example as a Win32 console app using Borland version 5.0 and 5.5.1, but both needed to #include <dos.h> (for FA_DIREC and FA_ARCH) to build. Or am I doing something wrong?

    And I think fflush(stdout); could be added following the prompt. My shell stared at me for a while before I read the code.

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Dave: Thats strange, my copy of Borland 5.5.1 (free command line compiler) has them defined in both.

    Anyway, I've added the fflush call.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    >Thats strange, my copy of Borland 5.5.1 (free command line compiler) has them defined in both.

    It was my bad. I had changed the compiler and linker paths (from 5.0 to 5.5.1) in my makefile, but missed changing the include and library paths.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it legal to have functions within functions?
    By Programmer_P in forum C++ Programming
    Replies: 13
    Last Post: 05-25-2009, 11:21 PM
  2. An array of macro functions?
    By someprogr in forum C Programming
    Replies: 6
    Last Post: 01-28-2009, 06:05 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Visual C++ 2005 linking and file sizes
    By Rune Hunter in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2005, 09:41 PM
  5. trouble defining member functions
    By dP munky in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2003, 08:52 PM

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