Hi All,

I am working on a program where I want to keep the length of message in bytes to further working on it.

the message got this string in it.

message^ m = gcnew message("usa.weather");

I have to keep the length of this argument that is routing key of this message "usa.weather" in bytes. Its so important for me to sort out this today. Please HELP

Recommended Answers

String Msg = "usa.weather";
message^ m = gcnew message(Msg);

unsigned char buffer[Msg.length()];
memcpy(buffer, Msg.data(), Msg.length());

OR

copy(Msg.begin(), Msg.end(), buffer);
Jump to Post

All 3 Replies

String Msg = "usa.weather";
message^ m = gcnew message(Msg);

unsigned char buffer[Msg.length()];
memcpy(buffer, Msg.data(), Msg.length());

OR

copy(Msg.begin(), Msg.end(), buffer);

Actually I want to count the length of a complete message in Rabbit MQ . May be anyone knows about it.

Is it a C++ 'string' or a c-style 'c-string'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.