GVKun编程网logo

FindFirstFile在根path上失败(find the path)

11

在本文中,我们将为您详细介绍FindFirstFile在根path上失败的相关知识,并且为您解答关于findthepath的疑问,此外,我们还会提供一些关于''Couldnotfindfirstlog

在本文中,我们将为您详细介绍FindFirstFile在根path上失败的相关知识,并且为您解答关于find the path的疑问,此外,我们还会提供一些关于''Could not find first log file name in binary log index file'' 的解决办法、.net – Win32 API FindFirstFile和FindNextFile性能与命令行、BluetoothFindFirstRadio 函数、C ++代码用FindFirstFile / FindNextFile删除文件夹中的所有文件的有用信息。

本文目录一览:

FindFirstFile在根path上失败(find the path)

FindFirstFile在根path上失败(find the path)

我正在使用下面的代码来获取有关文件系统目录的信息:

LPCTSTR pStrPath = L"D:\1"; WIN32_FIND_DATA wfd; HANDLE hDummy = ::FindFirstFile(pStrPath,&wfd); if(hDummy != INVALID_HANDLE_VALUE) { //Use 'wfd' info //... ::FindClose(hDummy); } else { int error = ::GetLastError(); }

代码工作得很好,除非我指定一个根path:

D: – 错误代码ERROR_FILE_NOT_FOUND

D: – 错误代码ERROR_FILE_NOT_FOUND

\SRVR-1share – 错误码ERROR_BAD_NET_NAME

\SRVR-1share – 错误码ERROR_BAD_NET_NAME

\SRVR-1HiddenShare$ – 错误代码ERROR_BAD_NET_NAME

但是它在以下情况下工作:

D:1 – 没有错误

\SRVR-1share1 – 没有错误

\SRVR-1HiddenShare$1 – 没有错误

任何想法为什么?

用C ++中的CreateProcess()启动语音识别

当ai_socktype已经指定的时候,调用getaddrinfo()的时候,ai_protocol还有什么其他目的。

setsockopt()SOL_IP API级别和IPT_SO_SET_REPLACE开关

x86-64 Linux NASM。 在C ++文件中声明为函数的int型数组的函数parameter passing

Visual C ++dynamic运行时库是现在Windows操作系统的一部分吗?

SFML undefined引用impl

在C#中获取Windows电源计划/scheme(使用WinAPI)

与特定的GLIBC版本链接

无法将Lua for Windowsembedded到C ++程序中

如何获得更详细的回溯

FindFirstFile()是用来枚举目录的内容。 因此,它的意思是与文件模式,如D:* 。

当您使用D:1您只是使用非常严格的文件模式( 1 )来过滤D:的文件,但是当您仅使用D:或D:根本没有模式!

共享资源也是如此。 请注意, \SRV-1share不会被视为模式,因为\SRV-1不能被视为目录。

''Could not find first log file name in binary log index file'' 的解决办法

''Could not find first log file name in binary log index file'' 的解决办法

数据库主从出错:

Slave_IO_Running: No 一方面原因是因为网络通信的问题也有可能是日志读取错误的问题。以下是日志出错问题的解决方案:

 

Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ''Could not find first log file name in binary log index file''

 

解决办法:从机器停止 slave

mysql> slave stop;

 

到 master 机器登陆 mysql:

记录 master 的 bin 的位置,例如:mysql> show mster status;+-------------------+----------+--------------+-------------------------------------------+| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |+-------------------+----------+--------------+-------------------------------------------+| mysqld-bin.000010 | 106 | | information_schema,mysql |+-------------------+----------+--------------+-------------------------------------------+ 日志为 mysqld-bin.000010

 

刷新日志:mysql> flush logs;

因为刷新日志 file 的位置会 + 1,即 File 变成为:mysqld-bin.000011

 

马上到 slave 执行

mysql> CHANGE MASTER TO MASTER_LOG_FILE=''mysqld-bin.000011'',MASTER_LOG_POS=106;

mysql> slave start;

mysql> show slave status\G;

.net – Win32 API FindFirstFile和FindNextFile性能与命令行

.net – Win32 API FindFirstFile和FindNextFile性能与命令行

遍历使用通配符模式查找文件的目录时,我们遇到了意外的性能问题.

我们有180个文件夹,每个包含10,000个文件.使用dir< pattern>的命令行搜索/ s几乎立即完成(<0.25秒).但是,从我们的应用程序,相同的搜索需要3-4秒. 我们最初尝试使用带有SearchOption.AllDirectories的System.IO.DirectoryInfo.GetFiles(),现在尝试使用Win32 API调用FindFirstFile()和FindNextFile(). 使用我们的代码进行分析表明绝大部分执行时间都花费在这些调用上. 我们的代码基于以下博文: http://codebetter.com/blogs/matthew.podwysocki/archive/2008/10/16/functional-net-fighting-friction-in-the-bcl-with-directory-getfiles.aspx

我们发现这很慢,所以更新GetFiles函数以采用字符串搜索模式而不是谓词.

任何人都可以对我们的方法可能出现的问题有所了解吗?

在我的测试中使用FindFirstFileEx和FindExInfoBasic和FIND_FirsT_EX_LARGE_FETCH比普通的FindFirstFile快得多.

使用FindFirstFile扫描包含约300,000个文件的20个文件夹需要661秒,使用FindFirstFileEx扫描需要11秒.对相同文件夹的后续调用只需不到一秒钟.

HANDLE h = FindFirstFileEx(search.c_str(),FindExInfoBasic,& data,FindExSearchNameMatch,NULL,FIND_FirsT_EX_LARGE_FETCH);

BluetoothFindFirstRadio 函数

BluetoothFindFirstRadio 函数

HBLUETOOTH_RADIO_FIND BluetoothFindFirstRadio(
    BLUETOOTH_FIND_RADIO_PARAMS* pbtfrp,
    HANDLE* phRadio
);

BluetoothFindFirstRadio函数开始枚举本地蓝牙无线电。

参数:

pbtfrp

Pointer to a BLUETOOTH_FIND_RADIO_PARAMS structure. The dwSize member of the BLUETOOTH_FIND_RADIO_PARAMS structure pointed to by pbtfrp must match the size of the structure. See Return Values for additional information about this parameter.

指向BLUETOOTH_FIND_RADIO_PARAMS结构的指针。pbtfrp指向的BLUETOOTH_FIND_RADIO_PARAMS结构的dwSize成员必须与结构的大小匹配。有关此参数的其他信息,请参阅返回值。

phRadio

Pointer to where the first enumerated radio HANDLE will be returned.

指向将返回第一个枚举的广播句柄的位置的指针。

返回值:

Returns a valid handle to the first Bluetooth radio upon successful completion; the phRadio parameter is a pointer to that handle.

Returns NULL upon failure. Call the GetLastError function for more information on the error. The following table describe common errors:

成功完成后返回第一个蓝牙电台的有效句柄;phRadio参数是指向该句柄的指针。

失败时返回NULL。调用GetLastError函数以获得关于错误的更多信息。下表描述了常见的错误:

Return code Description

ERROR_INVALID_PARAMETER

The pbtfrp parameter is NULL.  pbtfrp参数为空。

ERROR_REVISION_MISMATCH

The structure pointed to by pbtfrp is not the correct size.   pbtfrp指出的结构尺寸不正确。

ERROR_OUTOFMEMORY

Out of memory.   内存不足。

Header

Declared in BluetoothAPIs.h; include Bthsdpdef.h and BluetoothAPIs.h.

Library

Use Bthprops.lib.

C ++代码用FindFirstFile / FindNextFile删除文件夹中的所有文件

C ++代码用FindFirstFile / FindNextFile删除文件夹中的所有文件

我的目标是删除给定文件夹中的所有文件,但不删除文件夹本身。 我正在考虑调用FindFirstFile,然后重复调用FindNextFile,同时删除find的每个文件,使用下面的伪代码:

if(FindFirstFile(FindFileData)) { do { DeleteFile(FindFileData.FileName); } while(FindNextFile(FindFileData)); FindClose(FindFileData); //EDIT for people who didn''t see my pseudo-code remark }

但现在我在想,如果我允许删除文件,而在该文件夹中枚举? 或者换句话说,我是否需要首先cachingfind的所有文件名,然后删除它们,或者可以按照上面所示的方法进行操作吗?

文件扩展名

用Javareplace主机文件

编程创build的文件在Linux中成为NULL

为什么touch包含utimensat()系统调用?

用于重命名和重定位文件的Shell脚本

是的,您可以使用遍历这些行来安全地删除文件夹中的文件,前提是您可以正确获取API和逻辑详细信息(例如Frerich Raabe的评论)。

所以你的FindFirstFile将初始化一个WIN32_FIND_DATA结构,你的FindNextFile将引用同样的结构WIN32_FIND_DATA路。 只要你不损坏它,你可以随时删除文件。

FindFirstFile返回一个句柄,如果它有效,应该用FindClose释放。

总结

以上是小编为你收集整理的C ++代码用FindFirstFile / FindNextFile删除文件夹中的所有文件全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

今天关于FindFirstFile在根path上失败find the path的分享就到这里,希望大家有所收获,若想了解更多关于''Could not find first log file name in binary log index file'' 的解决办法、.net – Win32 API FindFirstFile和FindNextFile性能与命令行、BluetoothFindFirstRadio 函数、C ++代码用FindFirstFile / FindNextFile删除文件夹中的所有文件等相关知识,可以在本站进行查询。

本文标签: