Since you can't just say
How do I go about accomplishing this?Code:char instring[10]; int bufferA[10]; do{ (int)instring[countera]=bufferA[counterA]; countera++; } while.... bla bla bla
Since you can't just say
How do I go about accomplishing this?Code:char instring[10]; int bufferA[10]; do{ (int)instring[countera]=bufferA[counterA]; countera++; } while.... bla bla bla
the title of your post is exactly the opposite of what you actually want to do. that is the first problem.
your cast is in the wrong place. you need to cast the elements of bufferA to char to put them into instring. keep in mind that you potentially lose information this way, as most modern systems use a 32-bit int, and only an 8-bit char.
The purpose of the program is to have the user to enter a string of characters, such as a password. The program would then convert them to an integer array and then multiply each by a key, then write to a file. I've done something like this before, but each letter had to be typed in individually.
perhaps I should rephrase my question. I want to scramble the letters of a c style string. How can I do this?
A char array already is an integer array, no need to convert anything
Excuse my ignorance, (the only experience I have with this is from online tutorials) but what I take from what you said is thatis completely legit??Code:a= mystring[2] + 15;
Assuming that:
a is some integer type (say a 'char' for example), and that 'mystring' is an array of that type, and that [2] is a valid index in that array, then yes.This says:Code:a = mystring[ 2 ] + 15;
add 15 to the value stored in mystring[ 2 ] and store that in a.
Quzah.
Hope is the first step on the road to disappointment.