Monday, December 30, 2013

mac systems, how to compile and run. m file

Well everyone, brother just started learning objective-c,
Very depressed, in mac terminal, what command can compile and run. M file it,
For example, I now have a 123.m
 
# Import

int main (int argc, const char * argv [])
{
NSLog (@ "hello, LI Jialin!");
return (0);
}


Reply:
Have a look Shuba,. M file is the right method file
Reply:
gcc hello.m-o hello-ObjC-framework Foundation
Reply:
reference to the second floor nongmin reply:
gcc hello.m-o hello-ObjC-framework Foundation

Finally will, thank you, but also to ask me where this bit of code is wrong it
 
# Import

int main ()
{
char * word [5];

FILE * fin = fopen ("/ 123.txt", "r");

char temp [100];
int counter = 0;
while (fgets (temp, 100, fin))
{
temp [strlen (temp-1)] = '\ 0';
word [counter] = temp;
counter + +;
}

for (int i = 0; i <5; i + +)
{
NSLog (@ "% s's length is% d", word [i], strlen (word [i]));
}
return (0);
}

No comments:

Post a Comment