troubleshooting Question

How to set a TIdBytes variable in Borland C++ Builder 2007

Avatar of Roger Alcindor
Roger Alcindor asked on
C++Editors IDEs
2 Comments1 Solution3387 ViewsLast Modified:
I am porting an application from BCB 5 with Indy 9 to Borland C++ Builder 2007 using Indy 10
The Indy 9 SendBuffer function for a UDP server has two parameters for the data to send; being a char * and a length specifier.

Indy 10 makes it more complicated by introducing a single parameter of type TIdBytes which passes the same information.
The question is, how to generate a TIdBytes variable from a char * and length ? A function such as

TIdBytes MakeTIdBytes(char *data,int length); is required

The only way I can see to do this is something like the following which is a bit arcane if you want to send
a packet of a few hundres bytes :-


TIdBytes MakeTIdBytes(char *data,int length)
{
TIdBytes r;

    for(int i=0;i<length;i++)
    {
         r[i] = data[i];
    }
    return r;
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros