I have explicity declared my array to be 450 characters long.

But for some reason when I run the program I seem to be getting about 475 characters and they are all -52(ascii) from 450 to 475. I also do not seem to have a null character in my array to tell the program it is the end of the array.

Anyone can help me out?


Recommended Answers

All 6 Replies

How does our process handle carriage-returns and linefeeds?
Also, what is the final result you're trying to achieve?

Ok...so I have rejigged it a bit...I'm not great at c++...(usually doing C#)

I have a char array holding 446 characters..

some sorting gets done on that and this char array is then placed in to a string. This string is passed in to a function and for some reason this string becomes 472 characters long.

Would you like to see some code? Or maybe you know from telling you that...

What is the end result you're seeking?

The end result is to output readable text on to the console that has been decrypted. It is showing 472 characters when I only want 446 characters to show. (characters 446 - 472 are some random characters that seem to be added on the end)

I have done it now by sending in the size of the array to the function and saying while a variable is less than the sizeof the array.

But I would still be interested to know why this is happening if you or anybody else knows! Thanks

Got code?

Be a part of the DaniWeb community

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