ok so my compiler is doing something weird, for this like of code it is thinking the \d is a command like \n but that is a cstring, and it uses each char to decode a message to Attack at dawn!, but comes out missing the c, any hits or tips. char encoded[] = ":mmZ\dxZmx]Zpgy";

Recommended Answers

All 2 Replies

ok so my compiler is doing something weird, for this like of code it is thinking the \d is a command like \n but that is a cstring, and it uses each char to decode a message to Attack at dawn!, but comes out missing the c, any hits or tips. char encoded[] = ":mmZ\dxZmx]Zpgy";

Missing the c? What c? I don't see a c in the string. \ is the escape character. If you want a \ to not be interpreted as an escape character, but as a character, use two of them:

char encoded[] = ":mmZ\\dxZmx]Zpgy";
commented: Nice, traced the problem even when the O.P. wasn't at all clear with what he was trying to achieve. +6

Missing the c? What c? I don't see a c in the string. \ is the escape character. If you want a \ to not be interpreted as an escape character, but as a character, use two of them:

Yep the missing "c" was never clear at first, only when I read the post over and over I figured it **seems** like a substitution ciper, where

c = \
A = :
a = Z
t = m
<SPACE> = x .. etc

Hence the problem with the "c".

Amazing work VernonDozier, you hit the nail on the head even though you went in blind.

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.