0

Hi , i would like to include a normal conventiional function in to my obcetive c project. I have tried putting the body of the function outside the implementation section , inside the @implemenation section. I know it wont be part of the class i'm defining , but do i have to declare it somewhere in aheader file. i just get build errors

An example(or link to a an example) would be brilliant .

i just dont know how you do it???.please help !!

2
Contributors
1
Reply
23
Views
4 Years
Discussion Span
Last Post by adams161
0

I had not done this exactly but decided to try. I have an objective-c class for a program, dataparsing.m/h. I placed in it's .h file at the very bottom, below @end

void printInCOut(char *p);

At the tomp of the .m file above the @implementation line but below the import lines, I wrote out the function as:

void printInCOut(char *p)
{
NSLog(@"%s",p);

}

From within the dataparsing implmentation i called my c-style function with:

printInCOut("in here using a c style print");

It worked when i ran in the emulator that i saw in the XCode console the phrase "in here using a c style print" each time the method from my implemenation called it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.