Click here to Skip to main content
12,750,208 members (35,469 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ Win32 WinCE

I wrote a code to communicate with serial port ("com1:").
Under win32 API this works properly. In evc4, the same code compile without any error and establishes the link with ("com1:") but when it executes the readfile statement:
    hComm   ,       // handlePort_: handle of file to read
    (BYTE*)tmpMsg,  // inputData:handle of file to read
    400     ,       // sizeBuffer:number of bytes to read
    BytesRead,     // pointer to number of bytes read
    NULL    );      // pointer to structure for data

it shows that song is true but BytesRead=0.

Any hint to how to get it to work properly?
Posted 2-Oct-11 8:08am
Updated 2-Oct-11 8:13am
André Kraak 2-Oct-11 13:14pm
Edited question:
Added pre tags

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

DWORD dwError = ::GetLastError();
and call FormatMessage[^] to get the error details.
Albert Holguin 3-Oct-11 21:52pm
OP posted as solution:
the code for GetLastError() is 0, indicates that "the operation completed successfully".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170215.1 | Last Updated 3 Oct 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100