all groups > c# > march 2004 >
You're in the

c#

group:

cannot append string



Re: cannot append string mikeb
3/10/2004 2:29:51 PM
c#: [quoted text, click to view]

I'm going to assume that you're looking at the contents of the tagS
string only using the debugger. The debugger has bug when showing string
contents - it stops displaying the contents when it hits a null
character. in .NET, strings can contain nulls, and I'll bet that buffor
contains some zeros after the valid character data.

You will probably need to strip the nulls from the tagS string before
doing further manipulation of it:

tagS = tagS.Replace( "\0", "");

--
cannot append string winthux
3/10/2004 10:54:52 PM
I have something like this:
socket.Receive( buffor, 0, buffor.Length,
System.Net.Sockets.SocketFlags.None );

string tagS = System.Text.Encoding.ASCII.GetString( buffor );

// in tagS I have always tagS "<s i='404F8C46' c='1'>" , only i is changing

tagS += "</s>";

// this doesnt append tagS of the end tag and i dont know why, stays the
same. I have combined in very diffrent ways with chars, bytes and it happens
the same. Why ?

Re: cannot append string Jon Skeet [C# MVP]
3/11/2004 8:09:25 AM
[quoted text, click to view]

The first problem here is that your socket.Receive might not have
returned a buffer's worth of data. You should only be decoding the
amount of data you receive - take note of the return value of
socket.Receive.

[quoted text, click to view]

It definitely *does* append it, but depending on hor you're viewing it,
if you have any trailing 0 characters (which could come from the
problem above) they may prevent any subsequent characters from being
seen.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button