Article View: borland.public.cppbuilder.nativeapi
Article #5369CreateFile failed
From: sam
Date: Thu, 08 Sep 2005 10:28
Date: Thu, 08 Sep 2005 10:28
20 lines
1649 bytes
1649 bytes
Why CreateFile failed for opening an existing file ?
I use this code and CreateFile returned that the file g_sFileName doesn't
exists, but it really exists !
What is wrong ?
HANDLE hFile;
hFile = CreateFile(g_sFileName.c_str(),
GENERIC_READ|GENERIC_WRITE,// open for reading
FILE_SHARE_READ, // share for reading
NULL, // no security
OPEN_EXISTING, // existing file only
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
if (hFile == INVALID_HANDLE_VALUE)
{
ShowMessage(SysErrorMessage(GetLastError()));
}
Sam
Technical Details
Message-ID:
<43201217$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b57f9555954251b7,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "sam" <nospam@nospam.com> From: "sam" <nospam@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: CreateFile failed Date: Thu, 8 Sep 2005 12:28:39 +0200 Lines: 22 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 213.223.64.37 Message-ID: <43201217$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1126175255 213.223.64.37 (8 Sep 2005 03:27:35 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail