Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strings in C++.Net

Status
Not open for further replies.

cplsplsprogrammer

Programmer
Apr 18, 2005
42
US
Hello All, I am working with strings and got this problem. I have a pointer string which is populated by MQ series library function. I am trying to call function B from function A and trying to pass this message pointer string. When I see the pointer string in debug mode in function A i have the whole message but when I see the pointer string after passing to function B it is having only the first four characters before the null ('\0') occured the rest of the string is being chopped off. Can anyone please tell me what is happening.... how different are character array in C and String in .Net? I thought because of the null character the compiler is thinking that is the end of the string but my decleartion is pointer of strings, should it not take all the string? Please throw some light on strings in .Net.

function A( )
{
String* Msg;
// Send this pointer string to MQ series and I get a Message populated in the string.
// the message is like --- abcd'\0' efg '\0' '\0' klmnopqrws......................................... xyz

functionB( Msg );

}

function B( String* Msg )
{
//operation on that message
}

Thanks....
Ram
 
What is difference between String and String*. Is string* array of strings? Is there a way I can read each character in string as in C? How can i replace null characters from that string with a space?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top