int main(int argc, const char * argv[]) {
@autoreleasepool {
char xiaolongbao[666];
NSLog(@"输入一个字符串:");
scanf("%s",xiaolongbao);
NSString * str = [NSString stringWithUTF8String:xiaolongbao];
NSLog(@"str=%@",str);
}
return 0;
}
2015-09-30 15:03:22.139 OC1-第一个OC程序[1360:96122] 输入一个字符串:
xiaolongbao
2015-09-30 15:03:32.209 OC1-第一个OC程序[1360:96122] str=xiaolongbao
Program ended with exit code: 0 |