ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » Garbage in MQ paramater

Post new topic  Reply to topic
 Garbage in MQ paramater « View previous topic :: View next topic » 
Author Message
angka
PostPosted: Mon Oct 10, 2005 1:55 am    Post subject: Garbage in MQ paramater Reply with quote

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
View user's profile Send private message
Nigelg
PostPosted: Mon Oct 10, 2005 5:39 am    Post subject: Reply with quote

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
View user's profile Send private message
angka
PostPosted: Mon Oct 10, 2005 7:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Mon Oct 10, 2005 8:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
angka
PostPosted: Thu Oct 13, 2005 1:08 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Oct 13, 2005 3:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Garbage in MQ paramater
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.