I'm making a project on Windows and iOS.
In windows, I take input from user, convert it to byte array, manipulate the array by adding large random values to every byte (kind of like encoding it), then give the byte array converted to String back to the user.
I want to implement the same thing in an iOS app. I take input from a UITextField (outlet say: myTextField)
Now the thing is, how do I convert it to a byte array as in Windows and manipulate it. I searched stack overflow and found this piece of code
const char *bytearray = [self.myTextField.text UTF8String];
Using this, it gave me a byte array as I desired, but its a const char *, and I cannot manipulate it. So how do I store it in an array to manipulate it.
Also, when adding values to bytes in array in windows, if the value goes beyond 256, it stays within 256 automatically (say, 115 + 300, it is stored as 159), this eases my process of subtracting the value and getting the original value back. How can this be done in the iOS app.
For a better clarity, I'll give an example of how it works in Windows
byte array contains 'n' (Decimal value: 110)
adding 200 to it stores '6' (Decimal value: 54)
[310 % 256 = 54]
When retrieving back original value I subtract 200 from '6' (54 - 200 = -146)
and get the original value (256 - 146 = 110)
All this is done automatically, by using a byte array (this 256 - 146 thing)
How do I achieve this byte array capability in iOS?