如题所述
int lenght;
}index;
vector<index> vec;
vec.push_back();
vec.push_back();
........
å¯ä»¥å°ä¿åå¨vectorä¸çæ°æ®ä¸æ¬¡ç¨fwriteåå ¥å°äºè¿å¶æ件ä¸åï¼è¿æ¯è¦ä¸ä¸ªç»æä½ä¸ä¸ªç»æä½çåå ¥å¢ï¼
å¯ä»¥
FILE* fp = fopen( ... );
fwrite( &vec[0], 1 , vec.size()* sizeof(index) , fp );
}index;
vector<index> vec;
vec.push_back();
vec.push_back();
........
å¯ä»¥å°ä¿åå¨vectorä¸çæ°æ®ä¸æ¬¡ç¨fwriteåå ¥å°äºè¿å¶æ件ä¸åï¼è¿æ¯è¦ä¸ä¸ªç»æä½ä¸ä¸ªç»æä½çåå ¥å¢ï¼
å¯ä»¥
FILE* fp = fopen( ... );
fwrite( &vec[0], 1 , vec.size()* sizeof(index) , fp );
温馨提示:答案为网友推荐,仅供参考