文件是否存在

1,需要的函数FindFirstFile,

2,需要的结构体:WIN32_FIND_DATA

详解:

https://blog.csdn.net/veryhehe2011/article/details/7769814

https://blog.csdn.net/qq2399431200/article/details/11878611

https://www.cnblogs.com/qinguoyi/p/7252463.html

bool FileExist( LPCTSTR strFileName ) {
	
	WIN32_FIND_DATA FindData;

	ZeroMemory(&FindData, sizeof(FindData) / sizeof(WIN32_FIND_DATA));

	HANDLE hFind = FindFirstFile( strFileName , &FindData);
	if ( hFind == INVALID_HANDLE_VALUE || hFind == NULL) {
		// File not found
		return false;
	}

	FindClose( hFind );
	hFind = NULL;
	return true;
}

猜你喜欢

转载自blog.csdn.net/u012418428/article/details/83651700