|
大家好啊,小弟刚开始学objective-c,
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[])
{
NSLog (@"hello, LI Jialin!");
return (0);
}
|
|
|
都看看书吧,.m文件是方法文件吧
|
|
| 20分 |
gcc hello.m -o hello -ObjC -framework Foundation
|
|
终于会了,多谢,还请问,我这个小段代码那里错了呢
#import <Foundation/Foundation.h>
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);
}
|
|