CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2006
    Posts
    153

    Serial Communication (WriteFile)

    Hi all,

    I require some guidance on Serial communication.

    Currently, I have an array of data to send which are stored as

    unsigned short int sendData[10];

    so when I call writeFile, i pass the pointer to the start of sendData
    WriteFile(hComm, sendData, dwToWrite, &dwWritten, &osWrite)

    My question is What should I specify for the bytes to write field (dwToWrite)?

    - Should I specify 20 OR
    - Should I specify 2 and then keep incrementing the pointer to the next 2 bytes b4 i call WriteFile,

    eg. WriteFile(hComm, sendData[1], 2, &dwWritten, &osWrite)

    The reason why I am asking this question is I have another application file to READ in the data sent out (by the above codes), I cant seem to read in >1 byte of data... it only fills my receiver buffer with the 1st byte of data.

    Thank you
    FT
    Last edited by fulltime; October 10th, 2007 at 10:30 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured