Click here to Skip to main content
15,881,204 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Pointer to a function parameter Pin
Richard MacCutchan24-Sep-14 5:32
mveRichard MacCutchan24-Sep-14 5:32 
GeneralRe: Pointer to a function parameter Pin
econy24-Sep-14 6:47
econy24-Sep-14 6:47 
GeneralRe: Pointer to a function parameter Pin
Richard MacCutchan24-Sep-14 7:07
mveRichard MacCutchan24-Sep-14 7:07 
GeneralRe: Pointer to a function parameter Pin
econy24-Sep-14 10:13
econy24-Sep-14 10:13 
GeneralRe: Pointer to a function parameter Pin
econy24-Sep-14 10:16
econy24-Sep-14 10:16 
GeneralRe: Pointer to a function parameter Pin
Richard MacCutchan24-Sep-14 21:31
mveRichard MacCutchan24-Sep-14 21:31 
GeneralRe: Pointer to a function parameter Pin
Richard MacCutchan25-Sep-14 23:29
mveRichard MacCutchan25-Sep-14 23:29 
QuestionTrigger dialog method from non-windows app Pin
bkelly136-Sep-14 8:22
bkelly136-Sep-14 8:22 
SuggestionRe: Trigger dialog method from non-windows app Pin
Richard MacCutchan6-Sep-14 21:28
mveRichard MacCutchan6-Sep-14 21:28 
GeneralRe: Trigger dialog method from non-windows app Pin
bkelly137-Sep-14 5:03
bkelly137-Sep-14 5:03 
AnswerRe: Trigger dialog method from non-windows app Pin
Richard Andrew x647-Sep-14 7:25
professionalRichard Andrew x647-Sep-14 7:25 
GeneralRe: Trigger dialog method from non-windows app Pin
bkelly137-Sep-14 15:39
bkelly137-Sep-14 15:39 
GeneralRe: Trigger dialog method from non-windows app Pin
Richard Andrew x647-Sep-14 15:54
professionalRichard Andrew x647-Sep-14 15:54 
QuestionProgram for implementing Quine McCluskey's method for 8,9 or 10 variables Pin
Member 1103323724-Aug-14 16:55
Member 1103323724-Aug-14 16:55 
AnswerRe: Program for implementing Quine McCluskey's method for 8,9 or 10 variables Pin
Richard MacCutchan24-Aug-14 21:52
mveRichard MacCutchan24-Aug-14 21:52 
QuestionProgram for implementing Quine McCluskey's method for 8,9 or 10 variables Pin
Member 1103323724-Aug-14 16:38
Member 1103323724-Aug-14 16:38 
AnswerRe: Program for implementing Quine McCluskey's method for 8,9 or 10 variables Pin
Richard MacCutchan24-Aug-14 21:52
mveRichard MacCutchan24-Aug-14 21:52 
Questionunexpected address value in WSABUF ( RESOLVED ) Pin
bkelly1311-Aug-14 13:34
bkelly1311-Aug-14 13:34 
QuestionRe: unexpected address value in WSABUF Pin
Richard MacCutchan11-Aug-14 21:25
mveRichard MacCutchan11-Aug-14 21:25 
AnswerRe: unexpected address value in WSABUF Pin
bkelly1312-Aug-14 1:51
bkelly1312-Aug-14 1:51 
GeneralRe: unexpected address value in WSABUF Pin
Richard MacCutchan12-Aug-14 3:36
mveRichard MacCutchan12-Aug-14 3:36 
GeneralRe: unexpected address value in WSABUF Pin
bkelly1312-Aug-14 5:42
bkelly1312-Aug-14 5:42 
GeneralRe: unexpected address value in WSABUF Pin
Richard MacCutchan12-Aug-14 20:48
mveRichard MacCutchan12-Aug-14 20:48 
C++
typedef struct __WSABUF { u_long len; char FAR *buf; } WSABUF, *LPWSABUF;

You read the above as struct __WSABUF declares a structure whose contents are declared within the braces following. The typedef specifier creates synonyms for the following declaration, which in their turn can be modified types. In this case WSABUF is a synonym for the preceding structure declaration. *LPWSABUF is a synonym for a pointer to the structure: the preceding asterisk tells us that it is a pointer.
So the declaration
C++
LPWSABUF  p_lpwsabuf_array[ TCP_SERVER_PACKET_BUFFER_SIZE ];

declares an array of pointers. However according to the documentation for WSASend[^], the second parameter is a pointer to an array of WSABUF structures, not pointers, so it should be declared, and initialised something like:
C++
WSABUF  wsabuf_array[ TCP_SERVER_PACKET_BUFFER_SIZE ];

// ...

for (int i = 0; i < TCP_SERVER_PACKET_BUFFER_SIZE; ++i)
{
    wsabuf_array[i].len = 16;  // set the length of the buffer in this structure element
    wsabuf_array[i].buf = new char[16]; // allocate a character array and save its address in the structure
}

Then when you need to use a pointer to the array on a call to WSASEND you just use the array name, which the compiler converts to a pointer to the first element thus:
C++
int result = WSASend(socket, wsabuf_array, count, ... etc)

Does that make sense?
GeneralRe: unexpected address value in WSABUF Pin
bkelly1313-Aug-14 1:53
bkelly1313-Aug-14 1:53 
GeneralRe: unexpected address value in WSABUF Pin
Richard MacCutchan12-Aug-14 4:54
mveRichard MacCutchan12-Aug-14 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.