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 3243438
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:25:56+00:00 2026-05-17T18:25:56+00:00

Again I’m trying to wrap my head around Objective-C and Cocoa. So I’ve posted

  • 0

Again I’m trying to wrap my head around Objective-C and Cocoa. So I’ve posted some code below. What I’m trying to do is basically use the function “th_brk_line” by entering text into a UITextField then displaying it into a UITextView once it has been processed by “th_brk_line”. I’ve posted the external function definition and the typedef for “thchar_t” as well for clarity,I hope. I guess what I’m trying to accomplish is understanding how this C function would be used in Objective-C as well as a working example with UITextField and UITextView. This is an exercise mainly for my understanding the concept with Objective-C and Cocoa.

Thanks Again!

typedef unsigned char thchar_t; 

extern int th_brk_line(const thchar_t *in, thchar_t *out, size_t n, const char *delim);


int main () {

char line [1024];
char bline [1024];

while (fgets (line, sizeof line, stdin)) {
    if (line [strlen (line) - 1] == '\n')
        line [strlen (line) - 1] = '\0';

    th_brk_line (line, bline, 1024, "|");
    printf ("% s \n'", bline);
}

return 0;

}

  • 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-05-17T18:25:56+00:00Added an answer on May 17, 2026 at 6:25 pm

    At a high level, you need to put your text field and your text view on the screen and some sort of button that you press to make the text in the field appear in the view having been processed. You can use the keyboard’s return key to do this.

    On the assumption that you have done the above, calling a C function from Objective-C is easy. It’s exactly the same as calling it from C. The tricky bit is that your function expects a C string as input and gives you a C string as output. Look in to NSString -UTF8String and NSString +stringWithCString:encoding:

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

Sidebar

Related Questions

Again pulling my hair out due to some Flex/AS3 weirdness. The following code does
Again, I am new to JPA & Hibernation. I am trying to use JPA
I'm trying to get into java again (it's been a few years). I never
Again with the soap. I am trying to build a header using soap4r that
again. Right now I'm having issues with some pretty basic functionality in PHP. I
Once again I need some help. I'm working with a table that contains 3
again i am trying with soap method, but this time i downloaded the charles
(Again, an MVC validation question. I know, I know...) I'd like to use AutoMapper
Back again! I've been doing some async socket programming with select() on windows,and it's
Hey again guys. So, I'm trying to find out how to select every field

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.