|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Garbage in MQ paramater |
« View previous topic :: View next topic » |
Author |
Message
|
angka |
Posted: Mon Oct 10, 2005 1:55 am Post subject: Garbage in MQ paramater |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi all,
Why when i try to get the data from pMQPXP->RemoteQName, there is garbage attached to the end of the data. Anyone can help? Thank you
Regards |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Oct 10, 2005 5:39 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
Are you treating the data as a NULL-terminated string?
It is not, it is a string of length MQ_Q_NAME_LENGTH without a terminator. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
angka |
Posted: Mon Oct 10, 2005 7:34 pm Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi Nigelg,
So you mean I have to remove the garbage myself? Thank You.
Regards |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Oct 10, 2005 8:44 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
Quote: |
Are you treating the data as a NULL-terminated string?
It is not, it is a string of length MQ_Q_NAME_LENGTH without a terminator. |
Quote: |
So you mean I have to remove the garbage myself? |
You're kidding right?
Did you read this posting?
http://www.mqseries.net/phpBB2/viewtopic.php?t=20523
So, you are a newbie C programmer who does not know the difference between a NULL terminted string and a string that is not NULL terminted!?!
This is C programming 101. Seriously, time to take a course or read a book. Programming a MQ exit is advanced concepts.
Code: |
char qName[MQ_Q_NAME_LENGTH +1];
// copy it
memcpy(qName, pMQPXP->RemoteQName, MQ_Q_NAME_LENGTH);
// add a null terminator
qName[MQ_Q_NAME_LENGTH +1] = '\0'; |
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
angka |
Posted: Thu Oct 13, 2005 1:08 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi RogerLacroix,
Thank you. I understand C and not a beginner. What I meant is i need to insert the Null terminator myself.
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Oct 13, 2005 3:16 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
angka wrote: |
What I meant is i need to insert the Null terminator myself. |
Why? It's a known-length string. You know exactly how long it is, so just use that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|