|
Do you know how should i test if a directory exists in the file system, or a file?
Is that an article on CP regarding this subject?
rechi
|
|
|
|
|
#include <io.h>
if (_access(dir, 0)==0)
then it exists
-c
Cheap oil. It's worth it!
|
|
|
|
|
is this a better method that using CFindFile? does the _access function verify the user has access to the path as well, instead of just that it exists?
-dz
|
|
|
|
|
with mode 0, _access only checks for existence. other modes can test for read/write access.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Or: if( ::GetFileAttributes( pszFSpec ) == FILE_ATTRIBUTE_DIRECTORY ) ...
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
heres what i use..
BOOL CCommonFunctions::DirectoryExists(CString strPath)
{
CFileFind finder;
if (strPath.Right(1) != "\\")
strPath += _T("\\");
strPath += _T("*.");
BOOL bWorking = finder.FindFile(strPath);
if (!bWorking)
return FALSE;
finder.Close();
return TRUE;
} use it by saying:
if (!CCommonFunctions::DirectoryExists("C:\\Temp\\")
AfxMessageBox("ERROR!");
and for files..
BOOL CCommonFunctions::FileExists(CString strFilename)
{
CFileFind ff;
BOOL result = ff.FindFile(strFilename);
if (!result)
return false;
ff.Close();
return true;
} use it by saying:
if (!CComonFunctions::FileExists("C:\\test.txt")
AfxMessageBox("ERROR!"); that should help.. if someone has a better written function let me know..
-dz
|
|
|
|
|
I have a strange problem:
Because we need to run a process under another account (for COM+ rolebased security). To do so, we create a little startup application that displays a dialog where the user can enter its credentials. Then it uses the API call
CreateProcessWithLogonW to startup the real app. After this, our help does not work anymore. We use Windows 2000/XP with HTML help.
Does anyone have an idea?
Thanks,
Remon
|
|
|
|
|
An idea: Check the permissions on the HTML help directory and files.
|
|
|
|
|
Thanks for your reply.
It was much simpler. The default directory when running under another account was not the same (not the module directory). Therefore the helpfile could not be found.
|
|
|
|
|
Where to get HTTP proxy sources?
I mean REAL HTTP.
|
|
|
|
|
Go to sourceforge.net and search for "HTTP proxy". There are several projects under work that may suit your needs.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I am trying to thorughly test out some image processing code I have developed using GDI+.
I am wanting to test it with bottom-up scanline images, btw. the stride member of the bitmapdata class indicates this.
My problem is where can I get a bottom-up scanline image from!
Cheers
Richard
|
|
|
|
|
all bitmap files are bottom-up scanline. so a LoadBitmap might be what you need.
|
|
|
|
|
All of a sudden I'm having trouble opening my workspace in Visual C++ 6.0. When I try to open the workspace, it acts as if it's opening and has the status bar at the bottom to make it look like everything is fine, but then nothing comes up. No files open and the classview information doesn't show up. If I open up another workspace and then try to insert the project into that other workspace, I get an error message that just says "Out of Memory". Any ideas on what might be happening?
It started after I tried to run my program in Debug mode and my system blue-screened on me. I had to turn off my computer and then turn it back on and ever since then, it's been giving me this error.
|
|
|
|
|
No good answer, but the first thing i would do is delete all the .opt, .ncb, .aps, .clw, .plg and *.pch files in that project's folder(s) (these are all created as part of the build process).
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thank you! Thank you! Thank you!
|
|
|
|
|
I guess that got it
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I want a sample program to create two threads & only one thread access the CList object at a time. that is, one thread uses some(i don't know which) synchronization object to lock the CList object & writes to it and then releases the CList object. Next another thread does the same process, but instead of writing, it reads from the CList.
can anybody help?
Rsh
|
|
|
|
|
I'm sorry but time is not my friend right now to make an example, but you can start searching for this on MSDN: CMutex or CCriticalSection.
Hope this helps.
PS: if you have installed the MSDN Help from Visual Studio.NET then use this address:
ms-help://MS.VSCC/MS.MSDNVS/vccore/html/_core_Multithreading.3a_.How_to_Use_the_Synchronization_Classes.htm
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
You should use something like this:
CCriticalSection cs;
void CMyClass::FunctionThatAccessTheCList ()
{
cs.Lock ();
cs.Unlock ();
}
Best regards,
Alexandru Savescu
|
|
|
|
|
Pretyy cool one
Thanx Alexandru
Rsh
|
|
|
|
|
This post of mine explains a convenient approach to synchronizing access to a data structure.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank u Joaquín
This made my life more easier
Rsh
|
|
|
|
|
|
I always thought the whole thing's max length would be MAX_PATH (plus 1 for the terminating NULL)? But this is only true on 9X systems - I think there are ways of getting Windows NT-based systems to have UNICODE paths much longer than MAX_PATH.
But since I never compile in Unicode, I always just use MAX_PATH + 1 and hope for the best.
No generalization is 100% true.
Not even this one.
|
|
|
|