Computer Science Canada char to string |
Author: | unoho [ Wed Mar 30, 2011 4:29 pm ] | ||
Post subject: | char to string | ||
hey guys im trying to make a program that will encrypt text. my first step is to alter the text. for example, if i have "hello" as key, im trying to make it "ifmmp"... like every character should add 1. but it's not working for some reason. any idea wht might be wrong with it?
|
Author: | Tony [ Wed Mar 30, 2011 4:56 pm ] |
Post subject: | RE:char to string |
Moved to help (not a tutorial). Also, you've been here for long enough to know that "it's not working for some reason" is not a valid question. In which way does it "not work"? |
Author: | unoho [ Wed Mar 30, 2011 6:00 pm ] |
Post subject: | RE:char to string |
ooppsss...sorry for posting it in the wrong section and not stating the actual problem :S but ya...i got it to work..all i had to do is string me; me = temp; but thanks tony..i'll remember to ask proper question next time. ![]() |
Author: | yoursecretninja [ Wed Mar 30, 2011 6:04 pm ] | ||||
Post subject: | Re: char to string | ||||
I'm guess you're problem is trying to assign the char temp to the string me. You can't convert a character to a string like that. They are different data types. Try using sprintf to create a formatted string and to copy that formatted string into 'me'.
EDIT: My bad. My knowledge of C is limited to working with primitive types. When I read string me = temp my brain said char me[80] = temp. Anyway, glad you figured it out. |
Author: | Velocity [ Wed Nov 23, 2011 9:50 am ] |
Post subject: | RE:char to string |
Are you trying to created an MD5? or caeser? chrstring works for me |
Author: | md [ Wed Nov 23, 2011 10:24 am ] |
Post subject: | RE:char to string |
Once again, do not revive dead threads. This your *third* warning. |