我想生成一个不定长度的文件指针数组,怎么用?
我想生成一个文件指针数组,里面的文件指针个数是不定的,请问应该怎么定义啊?谢谢大家
程序代码:FILE **Fp_Array, **temp;
const int INITSIZE = 1;
int currentsize;
int ix;
currentsize = INITSIZE;
Fp_Array = ( FILE ** )malloc( currentsize * sizeof ( FILE *) );
assert( NULL != Fp_Array );
for( ix = 0; ; ++ix )
{
if( ix == currentsize )
{
currentsize += INITSIZE;
temp = ( FILE ** )realloc( Fp_Array, currentsize * sizeof( FILE *) );
assert( NULL != temp );
Fp_Array = temp;
}
}[此贴子已经被作者于2017-5-3 20:40编辑过]









