Re: CreateFile fails
- From: askaryatech@xxxxxxxxx
- Date: Thu, 27 Dec 2007 05:22:29 -0800 (PST)
1. Use GetModuleFileName() function to know full path of your
executable.
2. Use wcsrchr() to strip out extra parts with '\' as delimiter.
3. Append \\Files\\%s.bak to the result of step 2. Now you should have
absolute path of your file.
BTW, I hope your code snippet is not with that sequence, right? There
must be something between line 2 and line 3.
(AT)
http://www.askarya.com
On Dec 25, 9:32 pm, Steve <St...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have MFC based project, which run on HP iPAQ PDA under Windows Mobile 5.
I am trying to open file via parent directory as follows:
wchar_t fileName[128];
::memset(fileName, 0, sizeof(fileName ) ) ;
::wsprintf(fileName, L"..\\Files\\%s.bak", path ) ;
HANDLE file = ::CreateFile(fileName, GENERIC_READ, 0, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0 ) ;
The file I am trying to open exists in the path specified.
However CreateFile function fails with error: "The system cannot find the
file specified." Can anyone suggest what is wrong?
Thanks
Thanks
.
- Prev by Date: Re: CreateToolhelp32Snapshot returns invalid handle in PPC 6.0 device
- Next by Date: Re: List View Control Header Colour
- Previous by thread: Re: CreateFile fails
- Next by thread: Returning Data
- Index(es):
Relevant Pages
|