//
// main.m
// NSValue
//
// Created by facial on 26/8/15.
// Copyright (c) 2015 facial_huo. All rights reserved.
//
#import <Foundation/Foundation.h>
struct sct {
int a;
int b;
}test;
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
NSString *str = @"hey you";
//把字符串转换成nsdata类型
NSData * data = [str dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"%s", data.bytes); // 输出hey you
//把NSData转换成string类型
NSString *newStr = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog(@"%@", newStr);
}
return 0;
}