Re: [Dev-C++] Detecting the presence of a directory (was (no subject))
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-09-05 14:39:04
|
chdir is #included from where?
Does it return a value?
If it does what value does it return and for what reason?
----- Original Message -----
From: Dondolo Mpho
To: 'dev...@li...'
Sent: Friday, September 05, 2003 9:48 AM
Subject: [Dev-C++] (no subject)
Can somebody help me with this code. asks you to enter a folder name and users chdir() to check if the folder does exist.
I am trying to get it to device names and tell me if the device exist.....eg.
my computer name is AN1490812... so I would like to find out if the divice name C:\\ does exit on my computer.
Can anybody help?
struct _finddata_t file;
char name[64];
int main(void)
{
cout<<"Enter a folder name :";
cin>>name;
chdir("C:\\");
long flag=0;
if((flag=_findfirst(name,&file))==-1L)
{
cout<<"No matching files\n";
}
else if(file.attrib &_A_SUBDIR)
{
cout<<"\\found \n";
}
system("PAUSE");
return 0;
}
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software |