2012年4月7日星期六

simple example about write() and read()

unsigned char str1[]="I Love You";
    int n[5];
    ifstream in("xxx.xxx");
    ofstream out("yyy.yyy");
    out.write(str1,strlen(str1));//put the string str1 write in yyy. yyy file
       in.read((unsigned char*)n,sizeof(n));//from xxx.xxx  read designated integer, Note: type conversion
    in.close();out.close();

没有评论:

发表评论