NSData和NSString

 

    NSMutableString *whole = [self.textView.textStorage mutableString];

    [whole appendString:str];
    
    NSURL *url = [NSURL URLWithString:[fileDir stringByAppendingFormat:@"%@.h", name]];
    [str writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:nil];
    
    NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];    
    [data writeToURL:[NSURL URLWithString:[fileDir stringByAppendingFormat:@"%@.h", name]] atomically:YES];

 

posted @ 2013-02-03 22:44  静候良机  阅读(191)  评论(0编辑  收藏  举报