开发者

using c code in objective c

开发者 https://www.devze.com 2023-02-28 20:36 出处:网络
Objective C is meant to support C. I have some code in C language and I want to use it in objective C how is that possible? I know it is possible but I am not sure how.

Objective C is meant to support C. I have some code in C language and I want to use it in objective C how is that possible? I know it is possible but I am not sure how.

Edit

I want to use following code in objective C. How can I do it?

string FileMeasure="Hello FILE!"
int TempNumOne=FileMeasure.size();
char Filename[100];
for (int a=0;a<=开发者_如何学运维TempNumOne;a++)
{
    Filename[a]=FileMeasure[a];
}

Thanks

Pankaj


Objective-C is just a kind of layer over C...

If you have C libraries, C code, C functions, or whatever, you'll be able to use them from Objective-C...

Just think about Objective-C as a wrapper for object-oriented C code...

Maybe you'll have to add details, if you want a more specific answer...


Objective C is meant to support C.

Not sure what this means. Objective-C is a superset of C.

I have some code in C language and I want to use it in objective C

Just use it. Generally there's no magic required.


As language, you can consider Objective-C a "super set" of C, so that pure C code works fine when compiled in a Obj-C project; but this is about the language itself, the standard library (it is available in Obj-C as well), and any library with "C linkage". If it makes sense and if it will work or not depends on what exactly the C code does. E.g. if it uses a system-specific library, there could be a porting issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消