0

I have a problem with my caesar. It seems to be working just fine, key works and encoding does, even check50 says it's all right, but when I'm typing some plaintext it encodes it correctly and after encoded cipher it prints some strange marks: encryptin Hello, world!

When I'm typing some extra two marks, for example three '!' instead of one, it prints only as many chars as it should, but then when I again add another two '!' again it prints some additional marks: caesar bug

I know I'm missing something, but I have no idea what that is, so I'll be grateful for any help.

0

Without seeing your code, it's hard to tell what's going on.If I had to guess, I'd say that you are processing the plain text and storing the encoded text into a string variable but forgetting to add the end of string marker \0 onto the end of the text. When you finally print it out, it's printing some non-printable ascii chars (i.e., garbage data) on the end. It's probably continuing to print the string until it hits random data that actually represents the end of string marker. But that's just a guess, since I have no idea what your code looks like.

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .