Does C have any built in searching functions for files?
If so where can I get some info on this.
Thanks
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
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.
>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.
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]
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.
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]
>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.