It was a typo that I passed & of FileStatus Object. In the actualy code I've
written it properly.
The last error was set to 0.
I shalll try with the code you specified. But the CFile::GetStatus working
network file paths.
The code you listed wouldn't work for CFileFind. You need to call something
like:
f.FindFile(_T(\\\\myserver\\resource\\path\\*.*));
Here is the example from the docs:
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking) {
bWorking = finder.FindNextFile();
cout << (LPCTSTR) finder.GetFileName() << endl;
}
Are you sure the folder is really there? Perhaps last error is just set
from a previous call to something. Did you try calling SetLastError(0)
before doing the GetStatus() call? If you are looking for a folder you
could try ::PathIsDirectory().
One more thing on GetStatus()... don't put the &fs, just put fs. The call
is expecting a reference, not a pointere.
CFilestatus fs;
CFile::GetStatus(_T("C:\\MyFiles\\MyFile"),fs);
Tom
"Sarath" <Sarath@discussions.microsoft.com> wrote in message
news:DF739094-C5C3-4DBD-A563-29DB613E52C7@microsoft.com...
Hi All,
When I'm calling CFile::GetStatus with the shared folder in another
machine,
it's returning 0 and the last error points to "Access Denied".
I also tried with CFileFind class. The temp folder has full control for
the
currently logged user. The code working fine with local folders and files
but
not doing fine deal with shared network files and dirs.
e.g
Using CFileFind class
CFileFind f;
BOOL b = f.FindFile( "\\\\mysever\\temp" );
With CFile class
CFileStatus fs;
CFile::GetStatus("\\\\mysever\\temp",&fs);
--
-Sarath