本文整理汇总了C++中TIniFile::WriteString方法的典型用法代码示例。如果您正苦于以下问题:C++ TIniFile::WriteString方法的具体用法?C++ TIniFile::WriteString怎么用?C++ TIniFile::WriteString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIniFile
的用法示例。
在下文中一共展示了TIniFile::WriteString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormClose
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
IniFile->WriteString(SectionData, KeyUrl, URLEdit->Text);
IniFile->WriteString(SectionData, KeySocksServer, SocksServerEdit->Text);
IniFile->WriteString(SectionData, KeySocksPort, SocksPortEdit->Text);
IniFile->WriteString(SectionData, KeyProxyHost, ProxyHostEdit->Text);
IniFile->WriteString(SectionData, KeyProxyPort, ProxyPortEdit->Text);
IniFile->WriteBool(SectionData, KeyVerifyPeer, VerifyPeerCheckBox->Checked);
IniFile->WriteString(SectionData, KeyDoc, DocEdit->Text);
IniFile->WriteString(SectionData, KeyCertFile, CertFileEdit->Text);
IniFile->WriteString(SectionData, KeyPrivKeyFile, PrivKeyFileEdit->Text);
IniFile->WriteString(SectionData, KeyPassPhrase, PassPhraseEdit->Text);
IniFile->WriteString(SectionData, KeyCAFile, CAFileEdit->Text);
IniFile->WriteString(SectionData, KeyCAPath, CAPathEdit->Text);
IniFile->WriteString(SectionData, KeyAcceptableHosts, AcceptableHostsEdit->Text);
IniFile->WriteInteger(SectionData, KeySocksLevel, SocksLevelComboBox->ItemIndex);
IniFile->WriteInteger(SectionData, KeyHttpVer, HttpVersionComboBox->ItemIndex);
IniFile->WriteBool(SectionData, KeySessCache, SessCacheCheckBox->Checked);
IniFile->WriteBool(SectionData, KeyDebugEvent, DebugEventCheckBox->Checked);
IniFile->WriteBool(SectionData, KeyDebugOutput, DebugOutputCheckBox->Checked);
IniFile->WriteBool(SectionData, KeyDebugFile, DebugFileCheckBox->Checked);
delete IniFile;
}
示例2: StoreHistory
//---------------------------------------------------------------------------
void __fastcall CIniFile::StoreHistory(int nYear,int nMonth,int nDate,AnsiString strMessage)
{
AnsiString strFileName;
TIniFile *pIniFile;
int nFileMonth,nIndex;
strFileName.sprintf("%s\\Message History\\%4d_%02d_%02d.ini",IniFile_Dir,nYear,nMonth,nDate);
pIniFile = new TIniFile(strFileName);
nFileMonth=pIniFile->ReadInteger("Control","Month",1);
nIndex=pIniFile->ReadInteger("Control","Index",1);
if(nFileMonth!=nMonth)
{
nIndex=1;
pIniFile->WriteInteger("Control","Month",nMonth);
}
AnsiString strID;
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,strMessage);
nIndex++;
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//");
pIniFile->WriteInteger("Control","Index",nIndex);
delete pIniFile;
}
示例3: SaveToFile
void TSettings::SaveToFile() {
TSettings *Settings = TSettings::Instance();
TIniFile *ini = new TIniFile(".\\settings.cfg");
ini->WriteBool("Global", "FullScreen", Settings->Fullscreen);
ini->WriteInteger("Global", "Width", Settings->FormsWidth);
ini->WriteInteger("Global", "Height", Settings->FormsHeight);
ini->WriteInteger("Global", "Left", Settings->FormsLeft);
ini->WriteInteger("Global", "Top", Settings->FormsTop);
ini->WriteBool("Global", "Sound", Settings->SoundEnabled);
ini->WriteInteger("Global", "SoundVolume", Settings->SoundVolume);
ini->WriteBool("Global", "Music", Settings->MusicEnabled);
ini->WriteInteger("Global", "MusicVolume", Settings->MusicVolume);
ini->WriteBool("Global", "HostMode", Settings->HostMode);
ini->WriteString("Global", "LastBase", Settings->LastBase);
for (int i = 1; i <= 5; i++) {
ini->WriteString("Players", "Player" + IntToStr(i), Settings->PlayerNames[i - 1]);
ini->WriteInteger("Players", "PlayerType" + IntToStr(i), (int) Settings->PlayerType[i - 1]);
}
int i = 0;
for (std::map <String, String> ::iterator it = BaseFiles.begin(); it != BaseFiles.end(); ++it) {
ini->WriteString("Bases", "basename" + IntToStr(i), it->first);
ini->WriteString("Bases", "base" + IntToStr(i), ExtractFileName(it->second));
++i;
}
ini->Free();
}
示例4: SaveParam
void __fastcall TFormMain::SaveParam() {
TIniFile *ini = new TIniFile(ExtractFilePath(Application->ExeName) + PARAM_FILE);
ini->WriteString("ftp", "Host", this->Crypt(this->EditHost->Text));
ini->WriteString("ftp", "Login", this->Crypt(this->EditLogin->Text));
ini->WriteString("ftp", "Password", this->Crypt(this->EditPassword->Text));
ini->WriteString("ftp", "Port", this->Crypt(this->EditPort->Text));
ini->WriteString("ftp", "Pwd", this->Crypt(this->EditPwd->Text));
ini->Free();
}
示例5: TIniFile
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *ini;
ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI " ) );
ini->WriteInteger( "Form ", "Top ", Top );
ini->WriteInteger( "Form ", "Left ", Left );
ini->WriteString ( "Form ", "Caption ", Caption );
ini->WriteString ( "Form ", "DefaultDir ", Edit1->Text );
delete ini;
}
示例6: StoreHistoryNew
//---------------------------------------------------------------------------
void __fastcall CIniFile::StoreHistoryNew()
{
AnsiString strFileName;
TIniFile *pIniFile;
int nFileMonth,nIndex;
time_t timer;
struct tm *tblock;
int nSize=m_vecMsg.size();
if(nSize==0) return;
AnsiString strMsg;
strMsg.sprintf("訊息共有 %d 筆\n每筆花費時間約 10 ms\n是否要儲存訊息??",nSize);
if(Application->MessageBoxA(strMsg.c_str(),"Confirm",MB_ICONQUESTION|MB_OKCANCEL)!=IDOK) return;
/* gets time of day */
timer = time(NULL);
/* converts date/time to a structure */
tblock = localtime(&timer);
int nMonth=tblock->tm_mon;
int nDate=tblock->tm_mday;
strFileName.sprintf("%s\\Message History\\%d.ini",IniFile_Dir,nDate);
pIniFile = new TIniFile(strFileName);
nFileMonth=pIniFile->ReadInteger("Control","Month",1);
nIndex=pIniFile->ReadInteger("Control","Index",1);
if(nFileMonth!=nMonth)
{
DeleteFile(strFileName);
nIndex=1;
pIniFile->WriteInteger("Control","Month",nMonth);
}
AnsiString strID;
for(int nSz=0;nSz<nSize;nSz++)
{
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,m_vecMsg[nSz]);
nIndex++;
}
m_vecMsg.clear();
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//");
pIniFile->WriteInteger("Control","Index",nIndex);
delete pIniFile;
}
示例7: TIniFile
//---------------------------------------------------------------------------
void __fastcall TPOP3ExcercizerForm::FormCloseQuery(
TObject *Sender, bool &CanClose)
{
TIniFile *IniFile;
IniFile = new TIniFile(IniFileName);
IniFile->WriteString("Data", "Host", HostEdit->Text);
IniFile->WriteString("Data", "Port", PortEdit->Text);
IniFile->WriteString("Data", "UserName", UserNameEdit->Text);
IniFile->WriteString("Data", "Password", PassWordEdit->Text);
delete IniFile;
}
示例8: FormClose
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteString("Data", "URL", URLEdit->Text);
IniFile->WriteString("Data", "ProxyHost", ProxyHostEdit->Text);
IniFile->WriteString("Data", "ProxyPort", ProxyPortEdit->Text);
IniFile->WriteString("Data", "Data", DataEdit->Text);
IniFile->WriteString("Data", "DateTime", DateTimeEdit->Text);
delete IniFile;
}
示例9: FormCloseQuery
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
IniFile->WriteString(SectionData, KeyPort, PortEdit->Text);
IniFile->WriteString(SectionData, KeyServer, ServerEdit->Text);
delete IniFile;
}
示例10: FormDestroy
void __fastcall TMainForm::FormDestroy(TObject *Sender) {
if( !isCorrect ) // если выбраные файлы не открылись, не нужно их сохранять в .ini
return;
TIniFile *ini = new TIniFile(iniFile);
try {
ini->WriteString( "FileName", "file-copy", fcPanel->Caption );
ini->WriteString( "FileName", "cyclogram", cPanel->Caption );
}
__finally {
ini->Free();
clearAll();
}
}
示例11: FormClose
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteString(SectionData, KeyUserID, UserIDEdit->Text);
IniFile->WriteString(SectionData, KeyProxy, ProxyEdit->Text);
IniFile->WriteString(SectionData, KeyMessage, MessageEdit->Text);
IniFile->WriteString(SectionData, KeyEMail, EMailEdit->Text);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
}
示例12: FormClose
//---------------------------------------------------------------------------
void __fastcall TClientForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(IniFileName);
IniFile->WriteInteger("Window", "Top", Top);
IniFile->WriteInteger("Window", "Left", Left);
IniFile->WriteInteger("Window", "Width", Width);
IniFile->WriteInteger("Window", "Height", Height);
IniFile->WriteString("Data", "Server", ServerEdit->Text);
IniFile->WriteString("Data", "Port", PortEdit->Text);
IniFile->WriteString("Data", "Command", SendEdit->Text);
delete IniFile;
}
示例13: test_and_go_butClick
void __fastcall TFastConfigForm::test_and_go_butClick(TObject *Sender) {
db_prop.host = db_host_edit->Text;
db_prop.name = db_name_edit->Text;
db_prop.user = db_user_edit->Text;
db_prop.pass = db_pass_edit->Text;
tables_prefix = db_prf_edit->Text;
TIniFile *inifile = new TIniFile(config_ini_path);
inifile->WriteString("DB Connection Properties", "HostName", db_prop.host);
inifile->WriteString("DB Connection Properties", "Database", db_prop.name);
inifile->WriteString("DB Connection Properties", "User_Name", db_prop.user);
inifile->WriteString("DB Connection Properties", "Password", db_prop.pass);
inifile->WriteString("DB Connection Properties", "Prefix", tables_prefix);
delete inifile;
}
示例14: SaveFormPos
//---------------------------------------------------------------------------
void __fastcall SaveFormPos(TForm *Form,
const AnsiString IniFileName,
const AnsiString SectionName,
const AnsiString KeyName)
{
TIniFile *IniFile;
TWindowState WindowState;
char Buffer[256];
if (IniFileName.Length() == 0)
return;
// Create inifile object => Open ini file
IniFile = new TIniFile(IniFileName);
WindowState = Form->WindowState;
// If window minimized or maximized, restore to normal state
if (Form->WindowState != wsNormal)
Form->WindowState = wsNormal;
// Save the window's postion and size to the ini file
IniFile->WriteString(SectionName,
KeyName,
WindowPosToStr(Buffer, Form));
// Destroy inifile object => close ini file
IniFile->Free();
Form->WindowState = WindowState;
}
示例15: TIniFile
//---------------------------------------------------------------------------
void __fastcall TForm1::CodeBtnClick(TObject *Sender)
{
TCode Work;
String S = "";
// ask for code
if (InputQuery("Usage Code Entry", "Enter the code", S)) {
TIniFile* Ini = new TIniFile("ONGUARD.INI");
try {
// store the usage code in the ini file if it looks OK
if (HexToBuffer(S, &Work, sizeof(Work))) {
// save the value
Ini->WriteString("Codes", "UsageCode", S);
CodeLbl->Caption = S;
// tell the code component to test the new code, reporting the results
OgUsageCode1->CheckCode(true);
}
}
catch (...) {
delete Ini;
Ini = 0;
}
delete Ini;
}
}