Hello,
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;
}