2012年12月28日

c语言文件读写操作

摘要: int main(int argc, char * argv[]){ FILE *stream; char buf[20]; if ((stream = fopen("/Users/dtecadmin/Desktop/File.c", "rw+")) == NULL) { fprintf(stderr,"Cannot open output file.\n"); return 1; } fseek(stream,-6,2); fread(buf, 1,sizeof(buf),stream); printf("%s\n&quo 阅读全文

posted @ 2012-12-28 14:59 南瓜饼 阅读(617) 评论(0) 推荐(0) 编辑

C语言memcpy和strncat

摘要: #include <string.h>int main(int argc, const char * argv[]){ unsigned char* c=NULL; c = (unsigned char*)malloc(15); unsigned char d[5]={1,2,3,4,5}; unsigned char e[5]={11,22,33,44,55}; memcpy(c, d, sizeof(d)); memcpy(c+5, e, sizeof(e)); //strncat(c, d, sizeof(d)); //strncat(c,... 阅读全文

posted @ 2012-12-28 14:31 南瓜饼 阅读(784) 评论(3) 推荐(0) 编辑

IOS委托机制

摘要: 先说个简单的例子 妈妈每天要买菜,洗衣服,做饭和上班。妈妈想让爸爸上班。换成代码是妈妈有四个方法 买菜 洗衣服 做饭 上班四个函数,妈妈委托爸爸去上班,所以爸爸要实现上班的函数。先创建委托#import <Foundation/Foundation.h>@protocol setProtocol <NSObject>//上班-(NSString*)shangban;@end再创建妈妈这个类.h文件#import <Foundation/Foundation.h>#import "setProtocol.h"@interface Mothe 阅读全文

posted @ 2012-12-28 11:20 南瓜饼 阅读(1627) 评论(5) 推荐(2) 编辑

导航