本文整理汇总了C++中Profile::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ Profile::GetString方法的具体用法?C++ Profile::GetString怎么用?C++ Profile::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::GetString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
/**************************************************************************
* If the ISPELL environment variable isn't set, set it to the current *
* directory, before we change it. This assumes that the current *
* directory is also the directory to which Escriba (and ISPELL) was *
* installed. This is true with the basic installation. *
**************************************************************************/
#ifdef DEBUG
Log ( "Escriba::main: Setting ISPELL environment variable." ) ;
#endif // DEBUG
{
char *p = getenv ( "ISPELL" ) ;
if ( p == 0 ) {
static char SetString [_MAX_PATH+10] ;
sprintf ( SetString, "ISPELL=%s", HomePath ) ;
_putenv ( SetString ) ;
} /* endif */
}
/**************************************************************************
* Get application language module. *
**************************************************************************/
#ifdef DEBUG
Log ( "Escriba::main: Loading default language." ) ;
#endif // DEBUG
char DefaultLanguage [80] = { 0 } ;
{ /* startblock */
Profile IniFile ( PSZ(PROGRAM_NAME), 0, HomePath ) ;
if ( IniFile.QueryHandle() )
IniFile.GetString ( "Language", DefaultLanguage, sizeof(DefaultLanguage) ) ;
else
strcpy ( DefaultLanguage, "English" ) ;
} /* endblock */
Library = Language_Create ( PROGRAM_NAME, REVISION, IDS_TITLE1, DefaultLanguage ) ;
if ( Library == 0 ) {
Process Proc ( PROGRAM_NAME, HWND_DESKTOP, 0 ) ;
Debug ( HWND_DESKTOP, "ERROR: Unable to find language module for %s, %s, %s.", PROGRAM_NAME, REVISION, DefaultLanguage ) ;
return ( 1 ) ;
} /* endif */
LibraryHandle = Library->QueryHandle() ;
/**************************************************************************
* Get the program title. *
**************************************************************************/
ResourceString Title ( Library->QueryHandle(), IDS_TITLE ) ;
/**************************************************************************
* Determine the default codepage. *
**************************************************************************/
#ifdef DEBUG
Log ( "Escriba::main: Determining codepage to use." ) ;
#endif // DEBUG
PUSHORT pCodePage = Library->QueryCodepages() ;
while ( *pCodePage ) {
if ( !DosSetProcessCp ( *pCodePage ) )
break ;
pCodePage ++ ;
示例2: SystemProfile
Profile::Profile ( char *name, ANCHOR Anchor, char *HomePath, int MustExist ) : Ready ( FALSE ) {
/**************************************************************************
* Save the name. *
**************************************************************************/
Name = new char [ strlen(name) + 1 ] ;
strcpy ( Name, name ) ;
/**************************************************************************
* Perform other initializations. *
**************************************************************************/
#ifdef __OS2__
Opened = FALSE ;
Handle = 0 ;
#else // __NT__
ProfileName[0] = 0 ;
#endif // __OS2__ vs __NT__
/**************************************************************************
* Query the system INI for the profile file's path. *
**************************************************************************/
Profile SystemProfile ( Name ) ;
char *ProfilePath ( 0 ) ;
if ( SystemProfile.GetString ( "INIPATH", ProfilePath ) ) {
// Build the profile file name.
char FullPath [_MAX_PATH] ;
strcpy ( FullPath, ProfilePath ) ;
strcat ( FullPath, "\\" ) ;
strcat ( FullPath, Name ) ;
strcat ( FullPath, ".INI" ) ;
// Clean the name up and expand it to a full path.
char Path [_MAX_PATH] ;
_fullpath ( Path, FullPath, sizeof(Path) ) ;
// Does the file exist? If not, discard the name.
if ( access ( Path, 0 ) ) {
delete [] ProfilePath ;
ProfilePath = 0 ;
} /* endif */
} /* endif */
/**************************************************************************
* If the profile file couldn't be found, use the home path. *
**************************************************************************/
if ( ProfilePath == 0 ) {
ProfilePath = new char [ strlen(HomePath) + 1 ] ;
strcpy ( ProfilePath, HomePath ) ;
} /* endif */
/**************************************************************************
* If the path could be determined . . . *
**************************************************************************/
if ( ProfilePath ) {
/***********************************************************************
* Build the full profile file name. *
***********************************************************************/
strcpy ( ProfileName, ProfilePath ) ;
strcat ( ProfileName, "\\" ) ;
strcat ( ProfileName, Name ) ;
strcat ( ProfileName, ".INI" ) ;
/***********************************************************************
* Release the memory previously allocated to store the path. *
***********************************************************************/
if ( ProfilePath )
delete [] ProfilePath ;
/***********************************************************************
* If file must exist previously, test for this now. *
***********************************************************************/
if ( MustExist && access ( ProfileName, 0 ) )
return ;
/***********************************************************************
* Open/Create the profile file and return the resultant handle. *
***********************************************************************/
#ifdef __OS2__
Handle = PrfOpenProfile ( Anchor, PSZ(ProfileName) ) ;
if ( Handle == 0 ) {
char Message [512] ;
Log ( "Profile::Profile: Could not open INI file. %s", InterpretWinError(0,Message) ) ;
} else {
Opened = TRUE ;
Ready = TRUE ;
//.........这里部分代码省略.........