iov_set->iov_base+=cntcp; gives error
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > iov_set->iov_base+=cntcp; gives error




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    iov_set->iov_base+=cntcp; gives error  
Wim Deprez


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

Hello Group,

(still undusting and porting an old framework for reliable
multicasting)

the following (original) code processes an error (error C2036: 'void
*' : unknown size)

int cntcp;
struct iovec *iov_set ;

// ... (determine size of cntcp)
iov_set->iov_base+=cntcp;

well, I understand very well that this will turn into an error, but
what do I do then? What was the original programmers goal? I guess he
tries (tried) to read the information received from the multicastgroup
and uses the cntcp variable to browse the iov_set->iov_base buffer.
The problem is that you cannot add an int to a void *, I think you
should add it to the address like this:

iov_set->iov_base = cntcp + &iov_set->iov_base;

this code doesnot give an error. Might my thinking be ok? Or does the
fact that iov_set is already a pointer on itself complicate things?

Thanks in advance,

--wim





[ Post a follow-up to this message ]



    Re: iov_set->iov_base+=cntcp; gives error  
Lev Walkin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

Wim Deprez wrote:
> Hello Group,
>
> (still undusting and porting an old framework for reliable
> multicasting)
>
> the following (original) code processes an error (error C2036: 'void
> *' : unknown size)
>
>      int cntcp;
>      struct iovec *iov_set ;
>
>       // ... (determine size of cntcp)
>      iov_set->iov_base+=cntcp;
>
> well, I understand very well that this will turn into an error, but
> what do I do then? What was the original programmers goal? I guess he
> tries (tried) to read the information received from the multicastgroup
> and uses the cntcp variable to browse the iov_set->iov_base buffer.
> The problem is that you cannot add an int to a void *, I think you
> should add it to the address like this:
>
>              iov_set->iov_base = cntcp + &iov_set->iov_base;
>
> this code doesnot give an error. Might my thinking be ok? Or does the
> fact that iov_set is already a pointer on itself complicate things?

That's very simple one:

((char *)iov-set->iov_base) += cntcp;

--
Lev Walkin
vlm@lionet.info





[ Post a follow-up to this message ]



    Re: iov_set->iov_base+=cntcp; gives error  
Wim Deprez


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

Lev Walkin wrote:
> Wim Deprez wrote:
>
[...]
>
> That's very simple one:
>
> ((char *)iov-set->iov_base) += cntcp;
>

ah, I see it now :-) thanks a lot!,

--wim







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:16 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register