Re: [Dev-C++] List files and check if a directory exist.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <we...@ha...> - 2002-10-09 20:30:11
|
Hi Guys,
Thkz a lot Carlos.
>I haven't learned about it yet, but the solution is in >dirent.h, do a
search ...
Ok, i searched. But all examples that i found didn't compile.
See the example:
#include <stdio.h>
#include <dirent.h>
int main (){
DIR *dirh;
struct dirent *dirp;
static char mydir[20] = "/etc";
if ((dirh = opendir(mydir)) == NULL){
perror("opendir");
return(0);
}
for (dirp = readdir(dirh); dirp != NULL; dirp = readdir(dirh)){
printf("Got dir entry: %s\n",dirp->d_name);
}
closedir(dirh);
}
When i compile i received this error:
[Linker error] undefined reference to `opendir'
[Linker error] undefined reference to `readdir'
[Linker error] undefined reference to `closedir'
What is wrong ?? How to solve it ??
Ahhh, the lib dirent.h appear that haven't a funciont to check if a
directory exist. Someone knwo other way to check ??
Thkz a lot.
Best Regards.
[ ]'s
> Hi Guys,
>
> I have two doubts. If someone can help me... or give-me a example in C. :)
>
> 1) I want to check for example if the directory c:\windows exist. How to
do
> it ?
>
> 2) I want list all files that exist in directory c:\windows. How to do it
??
>
> Thkz a lot.
>
> Best Regards.
>
> [ ]'s
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|