Re: CreateFile, ReadFile, WriteFile woes - VisualC++
From: Robert W Hand (rwhand_at_NOSPAMoperamail.com)
Date: 03/03/05
- Next message: e2.bady_at_gmail.com: "Re: Beginner with problems(Pointers, gets, puts, getchar, putchar)"
- Previous message: Benjamin de Waal: "CreateFile, ReadFile, WriteFile woes - VisualC++"
- In reply to: Benjamin de Waal: "CreateFile, ReadFile, WriteFile woes - VisualC++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 03 Mar 2005 06:40:14 -0500
On Thu, 3 Mar 2005 21:52:51 +1100, "Benjamin de Waal"
<yttrium@optusnet.com.au> wrote:
> hCardRead = CreateFile("\\\\.\\a:", GENERIC_READ, 0, NULL,
>OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
<snip>
>CreateFile, ReadFile and WriteFile are supposed to work. So I tried a
>little experiment and found that if I replace "\\\\.\\a:" with
>"c:\\somefile.txt" it works perfectly. This makes me think what I'm doing
>really SHOULD work, just doesn't.
Sorry, but something specifically Windows is off-topic here.
<OT>I'm not sure what you are trying to do with "\\\\.\\a:", but it
does look wrong if you are trying to open a file. If you are trying
to open a volume rather than a file, there are some potential serious
problems with CreateFile. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/naming_a_file.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp
Have you tried something like: "c:\\DataFile.ext"? You might also
want to check GetLastError.</OT>
-- Best wishes, Bob
- Next message: e2.bady_at_gmail.com: "Re: Beginner with problems(Pointers, gets, puts, getchar, putchar)"
- Previous message: Benjamin de Waal: "CreateFile, ReadFile, WriteFile woes - VisualC++"
- In reply to: Benjamin de Waal: "CreateFile, ReadFile, WriteFile woes - VisualC++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|