2013.7.24作业

1、NSString -> char*和char*->NSString

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        NSString *str1=@"nsstring";
        char *str2=" c string";
        NSLog(@"nsssting->%@",str1);
        NSLog(@"c sting->%s",str2);
        printf("printf打印%s",str2);

        NSString *str3=[NSString stringWithUTF8String:str2];
        char *str4=[str1 UTF8String];
        NSLog(@"交换后nsssting->%@",str3);
        NSLog(@"交换后c sting->%s",str4);


    }
    return 0;
}

  

posted @ 2013-07-24 21:43  ymonke  阅读(126)  评论(0编辑  收藏  举报