Whether the FILE * or HANDLE, 40 to open a FILE, then open the FILE is failed, best not cb it elder sister ah, strives for the light,
CodePudding user response:
Failed to open the file returns the error code is?CodePudding user response:
GetLastError returns 183CodePudding user response:
ERROR_ALREADY_EXISTS error code of 183, is the file already exists. Are you open the file or create a file? You have open the file code issued to Chou Chou,CodePudding user response:
The test code as follows, very simple, an error occurred when num==47
String strFile="D: \ \ Data \ ";
Int num=0;
Char chNum [20].
VectorWhile (true)
{
Sprintf (chNum, "% d", num);
Num++;
String TMP=strFile + string (chNum);
TMP +=". TXT ";
The FILE * fp=fopen (TMP) c_str (), "wt");
If (fp==NULL)
{
DWORD ErrorNo=GetLastError ();
Sprintf (chNum, % d \ "0", ErrorNo);
ShowMessage (chNum);
}
VFiles. Push_back (fp);
}
CodePudding user response:
C + + Builder, the default use fopen to open the file number is limited: FOPEN_MAX under 32 bit is usually 50 (actual less than 50, because there are stdin/stdout/stderr), can be under 64, 512.Suggestions for Windows API: CreateFile to operation,
CodePudding user response:
VS didn't see this limitation, is there any way to break through the limits on c + + builder?Windows Api without this restriction, 3 q
CodePudding user response:
GCC and VC compiler there are limits, the default may be 512, can pass _setmaxstdio () to change, in c + + Builder, I recommend that you use CreateFileCodePudding user response:
Why is that? The great god,CodePudding user response: