本文整理汇总了C++中firebird::string::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ string::substr方法的具体用法?C++ string::substr怎么用?C++ string::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类firebird::string
的用法示例。
在下文中一共展示了string::substr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: svc_query_ex
static USHORT svc_query_ex(SC_HANDLE manager)
{
/**********************************************
*
* s v c _ q u e r y _ e x
*
**********************************************
*
* Functional description
* Report (print) the status and configuration
* of all installed Firebird services.
* If none are installed return FB_FAILURE
* so as to allow a call to svc_query for the
* status of the default instance.
*
**********************************************/
if (manager == NULL)
return FB_FAILURE;
DWORD lpServicesReturned = 0;
DWORD lpResumeHandle = 0;
DWORD pcbBytesNeeded = 0;
USHORT rc = FB_FAILURE;
EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, NULL, 0,
&pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle);
if ( GetLastError() == ERROR_MORE_DATA )
{
const DWORD dwBytes = pcbBytesNeeded + sizeof(ENUM_SERVICE_STATUS);
ENUM_SERVICE_STATUS* service_data = FB_NEW ENUM_SERVICE_STATUS [dwBytes];
EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, service_data, dwBytes,
&pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle);
if (lpServicesReturned == 0)
delete[] service_data;
else
{
Firebird::string serverServiceName;
bool firebirdServicesInstalled = false;
for ( DWORD i = 0; i < lpServicesReturned; i++ )
{
serverServiceName = service_data[i].lpServiceName;
if ( serverServiceName.substr(0, 8) == "Firebird" )
{
svc_query(service_data[i].lpServiceName, service_data[i].lpDisplayName, manager);
firebirdServicesInstalled = true;
}
}
delete[] service_data;
if ( firebirdServicesInstalled )
rc = FB_SUCCESS;
else
printf("\nNo named Firebird service instances are installed.\n");
}
}
return rc;
}