Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:05:00+00:00 2026-06-11T21:05:00+00:00

I’m making a project on Windows and iOS. In windows, I take input from

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:05:01+00:00Added an answer on June 11, 2026 at 9:05 pm

    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

    Take a look at NSString’s -getCString:maxLength:encoding: method, which will interpret the string using the encoding you specify and copy the result into the buffer you provide. You can then manipulate it however you like. There are one or two other methods along similar lines, but that one should get you started.

    To convert back to a NSString, you can use +stringWithCString:encoding, +stringWithUTF8String:, +stringWithCharacters:length:, or the -init... versions of any of those.

    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.

    It’s not the operating system that determines that sort of behavior, but the language. Objective-C’s behavior on this respect is just like that of C, C++, and probably C# — if you’re working with a type like unsigned char, values will be constrained to 0..255. After all, you can only fit so many values in 8 bits.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.