本文整理汇总了C++中TextFile::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::Close方法的具体用法?C++ TextFile::Close怎么用?C++ TextFile::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::Close方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxComboBox
TagBox::TagBox(ToolPanel *panel, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, wxString boxname, wxString modpath)
: wxComboBox(panel, id, label, wxDefaultPosition, size)
{
wxString filename, filepath;
wxString readline, tag, text;
TextFile opfile;
bool check;
path = modpath;
name = boxname;
diagbox = NULL;
labelset = false;
tag = "";
if(panel->mainwin) diagbox = panel->mainwin->diagbox;
diagbox->Write("\nTagBox init " + name + "\n");
// tag history load
if(name == "") {
diagbox->Write("Tag file not set\n");
return;
}
filename = name + "tags.ini";
check = opfile.Open(path + "/Tags/" + filename);
if(!check) {
if(diagbox) diagbox->Write("No tag history\n");
return;
}
diagbox->Write("Reading tag history " + filename + "\n");
readline = opfile.ReadLine();
while(!readline.IsEmpty()) {
//diagbox->Write("Readline " + readline + "\n");
readline = readline.AfterFirst(' ');
readline.Trim();
tag = readline;
Insert(tag, 0);
//diagbox->Write("Insert " + tag + "\n");
readline = opfile.ReadLine();
}
opfile.Close();
SetLabel(tag);
diagbox->Write(name + " " + tag + "\n");
if(tag != "") labelset = true;
}
示例2: OptionStore
void HypoMain::OptionStore()
{
wxString filename;
wxString outline;
filename = "Init/hypoprefs.ini";
TextFile opfile;
opfile.New(filename);
opfile.WriteLine(outline.Format("startmod %d", startmod));
opfile.WriteLine(outline.Format("numdraw %d", numdraw));
opfile.WriteLine(outline.Format("viewheight %d", viewheight));
opfile.WriteLine(outline.Format("viewwidth %d", viewwidth));
opfile.WriteLine(outline.Format("ylabels %d", ylabels));
opfile.WriteLine(outline.Format("datsample %d", datsample));
opfile.WriteLine(outline.Format("basic %d", basic));
opfile.WriteLine(outline.Format("diagnostic %d", diagnostic));
opfile.Close();
filename = "Init/hypopaths.ini";
opfile.New(filename);
opfile.WriteLine(datapath);
opfile.WriteLine(parampath);
opfile.WriteLine(outpath);
opfile.WriteLine(modpath);
opfile.Close();
}
示例3: MainLoad
void MainFrame::MainLoad()
{
long numdat;
int i, check, boxindex;
wxString filename, filepath;
wxString readline, numstring;
TextFile infile;
wxPoint pos;
wxSize size;
//filepath = GetPath();
filepath = "Init//";
// Box Load
filename = "mainbox.ini";
check = infile.Open(filepath + filename);
if(!check) return;
readline = infile.ReadLine();
//tofp.WriteLine(readline);
while(!readline.IsEmpty()) {
numstring = readline.BeforeFirst(' ');
numstring.ToLong(&numdat);
boxindex = numdat;
if(boxindex >= toolset->numtools) break;
pos.x = ReadNextData(&readline);
pos.y = ReadNextData(&readline);
size.x = ReadNextData(&readline);
size.y = ReadNextData(&readline);
if(toolset->box[boxindex]->servant) toolset->box[boxindex]->visible = (bool)ReadNextData(&readline);
else toolset->box[boxindex]->visible = true;
if(pos.x >= -5000 && pos.x < 5000 && pos.y >= -5000 && pos.y < 5000) toolset->box[boxindex]->mpos = pos;
if(size.x >= 50 && size.x < 2000 && size.y >= 50 && size.y < 2000) toolset->box[boxindex]->boxsize = size;
readline = infile.ReadLine(); // Read next line
//tofp.WriteLine(readline);
}
infile.Close();
for(i=0; i<toolset->numtools; i++) {
toolset->box[i]->ReSize();
toolset->box[i]->Show(toolset->box[i]->visible);
}
}
示例4: BaseStore
void GraphBase::BaseStore(wxString path, wxString tag)
{
int i;
TextFile outfile;
wxString text, filename, filetag;
filename = "gbase-" + tag + ".dat";
//outfile.New(initpath + "/Graphs/" + filename);
outfile.New(path + "/" + filename);
for(i=0; i<numgraphs; i++) {
outfile.WriteLine(graphstore[i].StoreDat(GetTag(i)));
//outfile.WriteLine(text.Format
}
outfile.Close();
}
示例5: GHistStore
void Model::GHistStore()
{
wxString filename, filepath;
wxString text;
TextFile outfile;
int i;
//if(path == "") filepath = "Init";
//else filepath = path;
filepath = GetPath();
wxComboBox *gstag = mainwin->scalebox->gstag;
filename = modname + "gshist.ini";
outfile.New(filepath + "/" + filename);
for(i=gstag->GetCount()-1; i>=0; i--)
outfile.WriteLine(text.Format("graph %s", gstag->GetString(i)));
outfile.Close();
}
示例6: OnClose
void ToolBox::OnClose(wxCloseEvent& event)
{
TextFile ofp;
wxString text;
ofp.Open("boxdiag.txt");
if(servant || child) {
Show(false);
ofp.WriteLine(text.Format("hide box %d, child %d", boxindex, child));
}
else if(canclose) {
ofp.WriteLine(text.Format("close box %d, mod boxes %d", boxindex, toolset->numtools));
//if(mod != NULL) mod->modtools.RemoveBox(boxindex);
//mainwin->toolset.RemoveBox(boxindex);
toolset->RemoveBox(boxindex);
Destroy();
}
ofp.Close();
}
示例7: GetString
TagBox::~TagBox()
{
int i;
wxString filename, filepath, outline, text;
TextFile opfile;
//if(diagbox) diagbox->Write(text.Format("closing tag box %s\n", name));
// Tag history
if(name == "") return;
filename = name + "tags.ini";
filepath = path + "/Tags/";
if(!wxDirExists(filepath)) wxMkdir(filepath);
opfile.New(filepath + filename);
for(i=GetCount()-1; i>=0; i--) {
outline.Printf("tag %s", GetString(i));
opfile.WriteLine(outline);
}
opfile.Close();
}
示例8: BaseLoad
void GraphBase::BaseLoad(wxString path, wxString tag, wxTextCtrl *textbox)
{
int i, index;
TextFile infile;
wxString readline, filename, filetag;
wxString text, numstring, namestring, basestring;
wxString gtag, gname;
double numdat;
GraphDat *graph;
int version;
filename = "gbase-" + tag + ".dat";
//if(!infile.Open(initpath + "/Graphs/" + filename)) return;
if(!infile.Open(path + "/" + filename)) return;
if(textbox) textbox->AppendText(text.Format("Loading %d graphs\n", numgraphs));
i = 0;
readline = infile.ReadLine();
// Version check
//fileversion = ParseLong(&vstring, 'v');
//textbox->AppendText(text.Format("Base file version %d\n", fileversion));
//if(fileversion < version) textbox->AppendText(text.Format("Create base index\n"));
while(!readline.IsEmpty()) {
if(readline.GetChar(0) == 'v') version = ParseLong(&readline, 'v'); // check file version for backwards compatability
else version = 0;
//textbox->AppendText(text.Format("Base file version %d\n", version));
//textbox->AppendText(text.Format("Readline %s\n", readline));
if(version >= 2) { // Modern, reference by tag
gtag = ParseString(&readline, 'g');
graph = GetGraph(gtag);
if(graph) graph->LoadDat(readline, version);
}
else {
//GetGraphFromName(gname)->LoadDat(readline, version); // Should add code to chop off any tag first
//int ndex = readline.Find("name");
//textbox->AppendText(text.Format("Base file version %d\n", version));
//textbox->AppendText(text.Format("Readline %s\n", readline));
namestring = readline.Mid(readline.Find("name"));
//textbox->AppendText(text.Format("Name string %s\n", namestring));
gname = ParseString(&namestring, 'e');
gname.Replace("_", " ");
if(textbox) textbox->AppendText(text.Format("gname %s\n", gname));
graph = GetGraphFromName(gname);
if(graph) graph->LoadDat(readline, version);
}
//graphstore[i].LoadDat(readline, version);
if(infile.End()) break;
readline = infile.ReadLine();
i++;
}
infile.Close();
// Read graphbase entries
/*
while(!readline.IsEmpty()) {
graphstore[i].diagbox = mainwin->diagbox;
graphstore[i].LoadDat(readline, version);
if(infile.End()) break;
readline = infile.ReadLine();
i++;
}
infile.Close();
*/
}
示例9: IsisMain
//.........这里部分代码省略.........
oFile.Open(ui.GetFilename("RESIDUALS"), "overwrite");
oFile.PutLine("Sample,\tLine,\tX,\tY,\tSample Error,\tLine Error\n");
}
//Gather the statistics for the residuals from the least squares solutions
Statistics sampErr;
Statistics lineErr;
vector<double> sampResiduals = sampSol.Residuals();
vector<double> lineResiduals = lineSol.Residuals();
for(int i = 0; i < (int)sampResiduals.size(); i++) {
sampErr.AddData(sampResiduals[i]);
lineErr.AddData(lineResiduals[i]);
}
//If a residuals file was specified, write the previous data, and the errors to the file.
if(ui.WasEntered("RESIDUALS")) {
for(int i = 0; i < sampSol.Rows(); i++) {
vector<double> data = sampSol.GetInput(i);
iString tmp = "";
tmp += iString(sampSol.GetExpected(i));
tmp += ",\t";
tmp += iString(lineSol.GetExpected(i));
tmp += ",\t";
tmp += iString(data[0]);
tmp += ",\t";
tmp += iString(data[1]);
tmp += ",\t";
tmp += iString(sampResiduals[i]);
tmp += ",\t";
tmp += iString(lineResiduals[i]);
oFile.PutLine(tmp + "\n");
}
}
oFile.Close();
//Records the error to the log
PvlGroup error( "Error" );
error += PvlKeyword( "Degree", degree );
error += PvlKeyword( "NumberOfPoints", (int)sampResiduals.size() );
error += PvlKeyword( "SampleMinimumError", sampErr.Minimum() );
error += PvlKeyword( "SampleAverageError", sampErr.Average() );
error += PvlKeyword( "SampleMaximumError", sampErr.Maximum() );
error += PvlKeyword( "SampleStdDeviationError", sampErr.StandardDeviation() );
error += PvlKeyword( "LineMinimumError", lineErr.Minimum() );
error += PvlKeyword( "LineAverageError", lineErr.Average() );
error += PvlKeyword( "LineMaximumError", lineErr.Maximum() );
error += PvlKeyword( "LineStdDeviationError", lineErr.StandardDeviation() );
Application::Log( error );
//Close the input cubes for cleanup
p.EndProcess();
//If we want to warp the image, then continue, otherwise return
if(!ui.GetBoolean("NOWARP")) {
//Creates the mapping group
Pvl mapFile;
mapFile.Read(ui.GetFilename("MAP"));
PvlGroup &mapGrp = mapFile.FindGroup("Mapping",Pvl::Traverse);
//Reopen the lat and long cubes
latCube = new Cube();
latCube->SetVirtualBands(ui.GetInputAttribute("LATCUB").Bands());
latCube->Open(ui.GetFilename("LATCUB"));
lonCube = new Cube();
lonCube->SetVirtualBands(ui.GetInputAttribute("LONCUB").Bands());