简体   繁体   English

文件最大数量限制是多少?

[英]What is the maximum number of files limit?

What is the maximum number of files limit in this code? 此代码中文件的最大数量限制是多少?

FIX: Common File Dialog Multiple Selection File Limit http://support.microsoft.com/kb/179372 FIX:通用文件对话框多个选择文件限制http://support.microsoft.com/kb/179372

The sample code on the page you linked to uses this: 您链接到的页面上的示例代码使用以下代码:

 DWORD MAXFILE = 2562;
 dlg.m_ofn.nMaxFile = MAXFILE;
 char* pc = new char[MAXFILE];

The buffer pc is 2562 characters long, the number of files that can be opened is limited by this. 缓冲区pc长度为2562个字符,由此可以打开的文件数受到限制。 As long as the total length of all the selected file names together (including path) fit's in these 2562 bytes, it succeedes, otherwise it fails. 只要所有选定文件名(包括路径)的总长度都适合这2562字节,它就会成功,否则就会失败。 So the actual number of files possible depends on the length of the file names you want to open. 因此,实际可能的文件数量取决于您要打开的文件名的长度。

You can detect if the buffer was to small by checking for FNERR_BUFFERTOOSMALL : 您可以通过检查FNERR_BUFFERTOOSMALL来检测缓冲区是否过小:

if(CommDlgExtendedError() == FNERR_BUFFERTOOSMALL) {
  // the buffer was to small, not all file names did fit into it
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM