Home > Back-end >  How to remove "opens the file at the same time the maximum number of limit
How to remove "opens the file at the same time the maximum number of limit

Time:11-06

C + + builder build to open 64 files at the same time, under the project of simple code is as follows:


The FILE * p [64];
Int I;
AnsiString STR.
for(i=0; i<64; I++)
{
STR=IntToStr (I) + ". TXT ".
If ((p [I]=fopen (STR) c_str (), "wt"))
==NULL)
{
ShowMessage (STR);
return ;
}
}
STR=STR + "complete";
ShowMessage (STR);


Found only 47 file,

Excuse me each warrior, where this is to limit the?

Can remove this restriction?

thank you

CodePudding user response:

Can be dealt with by close the file,

CodePudding user response:

C + + Builder with fopen open at the same time the maximum number of files have, defined in _nfile. H, the default is 50
# define _NFILE_ 50
In addition to each process of the default stdin, stdout, stderror three file handle, only 47 file open,

CodePudding user response:

My head in a program to add the following code:
#include<_nfile. H>
# define _NFILE_ 70

The results appear the following error:
W8017 Redefinition of '_NFILE_ "is not idetical

I do not know where is wrong, how can you change "at the same time open the file number of ceiling"?

CodePudding user response:





I do not know where is wrong, how can you change "at the same time open the file number of ceiling"?

CodePudding user response:

Try this undef, the word count

CodePudding user response:

Fopen is the foundation of C functions, in addition to ccrun said that limit, estimates there are considerations such as allocating memory,
You can switch to FileCreate, FileOpen this way, no problem for certain,
  • Related