Spotlight
Spotlight

Reputation: 482

Conver CFStringRef to C counterpart?

I am converting an objective-c program to a C program in linux. I have most of it covered, but I cannot find the C counterpart for CFStringRef.

I would guess that its counterpart is char but I am not sure.

Thank you in advance!

Upvotes: 0

Views: 212

Answers (2)

Spotlight
Spotlight

Reputation: 482

As noted in the comments, CoreFoundation is open source. It is easier to compile it and use the built in functions then to find their C counterpart.

Upvotes: 0

Linuxios
Linuxios

Reputation: 35803

CFStringRef is a string, and in C, strings are char*s.

They both, at some high level of abstraction, are strings. However, you aren't going to find C equivalents to many Objective-C constructs because Objective-C is simply a higher level language. CFStringRef is essentially a pointer to an "object" that can do nearly everything that NSString can. char* is an array of characters that can be manipulated by a few builtin functions and that requires manual memory management. You'll find that many things that you could do with one function call using CFStringRef will require quite a few lines in C just to do the memory management.

Upvotes: 1

Related Questions