Help with strncpy - crypt code
This is my first post in this forum : )
I am newbie but with a huge interest to learn Borland C++ ( 5.5.1)
I have a piece of code here that is burning my brain : (
The code is simple :
I put a word(or phrase - I do not want limitation ,but lets say here “abc” ) and my code will get each letter of this word and replace with my “Code array”
So lets say that
And c = YTp
In the end of the function , instead of I have “abc” , I will get a string with “ duL1TQ YTp”. Later ,I have the decrypt function , which is going to write back to me “abc”.
However , I am facing 2 problems :
a) For all word that I write, always there is some “extra ASC characters” in the begin og my string.
For example to “abc” , I get “asc code abc” . I want just my “abc” ... : ( .
I think this issue is on line 123 when I write “strncpy (letter, &text[c], 3); ”
b) If I write a huge word like “amfrnbcduo;werlbnbdvgwetgfdefoerp” , it returns me just “asc code amfrnb”. Nothing else. I do not want limitation...
Thank you everybody and I hope I can help anyone here as well