|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CreateFile() problem
Are there any windows programmers around? I'm having some issues with CreateFile() from the win32 api. I'm compiling with MinGW and it's giving me the following error:
loader\serialio.cpp:192: error: cannot convert `const char*' to `const WCHAR*' for argument `1' to `void* CreateFileW(const WCHAR*, DWORD, DWORD, _SECURITY_ATTRIBUTES*, DWORD, DWORD, void*)' here's the appropriate code: port = CreateFile(dev.c_str(),GENERIC_READ|GENERIC_WRITE, 0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); dev is a std::string. I'm new to windows programming, so I might be missing something. All the documentation I can find, however, says that the first parameter should be a null terminated string. c_str() is supposed to give me that. I've also tried to use the following and I get an idential error: port = CreateFile("COM1",GENERIC_READ|GENERIC_WRITE,0,0,O PEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); Which leads me to believe that it's not that simple. |
|
#2
|
|||
|
|||
|
Re: CreateFile() problem
I figured it out. My Makefile was trying to be helpful and defined UNICODE in the compiler options. Apparently, the compiler doesn't like that. I'm not really sure why it's defined or why it works without it, but it taking it out fixed the problem.
|
|
#3
|
||||
|
||||
|
Re: CreateFile() problem
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: CreateFile() problem
Quote:
Matt |
|
#5
|
|||||
|
|||||
|
Re: CreateFile() problem
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Problem: Extremely Frustrating | chantilly_team | Programming | 19 | 12-02-2005 23:00 |
| Physics Problem | Venkatesh | Math and Science | 13 | 30-11-2004 20:30 |
| Ok one problem | cantwell03 | Programming | 3 | 13-02-2003 07:28 |
| The problem with scouting... | archiver | 2001 | 10 | 23-06-2002 23:49 |
| Major problem with chipphua motors | aka Scott White | Motors | 18 | 19-03-2002 19:44 |