I did an experiment using the following code and found that DOS under WinXP command line also has a limit on the number of simultaneously opened files! My XP can only open 15 files simultaneously.
If under pure DOS or Win9X, you can solve it by modifying the FILES=?? in the c:\Config.Sys file. How to solve it under XP!
void MyDebug()
{
int i;
char buf;
FILE* psFile;
for (i = 0; i < 20; i++)
{
sprintf(buf, "Abcde-%02d.Txt", i + 1);
psFile = fopen(buf, "a+b");
}
for (i = 0; i < 20; i++)
{
printf("\nFile%02d::%08lX", i + 1, (unsigned long)psFile);
if (NULL != psFile)
{
::fclose( psFile );
psFile= NULL;
}
}
getch();
return;
}
Execution result is:
File01::75BF71CE
File02::75BF71E2
File03::75BF1F6
.....
File14::75BF72D2
File15::75BF72E6
File16::00000000
File17::00000000
File18::00000000
File19::00000000
File20::00000000
[ Last edited by firstsail on 2010-1-28 at 19:13 ]
If under pure DOS or Win9X, you can solve it by modifying the FILES=?? in the c:\Config.Sys file. How to solve it under XP!
void MyDebug()
{
int i;
char buf;
FILE* psFile;
for (i = 0; i < 20; i++)
{
sprintf(buf, "Abcde-%02d.Txt", i + 1);
psFile = fopen(buf, "a+b");
}
for (i = 0; i < 20; i++)
{
printf("\nFile%02d::%08lX", i + 1, (unsigned long)psFile);
if (NULL != psFile)
{
::fclose( psFile );
psFile= NULL;
}
}
getch();
return;
}
Execution result is:
File01::75BF71CE
File02::75BF71E2
File03::75BF1F6
.....
File14::75BF72D2
File15::75BF72E6
File16::00000000
File17::00000000
File18::00000000
File19::00000000
File20::00000000
[ Last edited by firstsail on 2010-1-28 at 19:13 ]
