本文整理汇总了C++中ofstream::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ ofstream::fill方法的具体用法?C++ ofstream::fill怎么用?C++ ofstream::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofstream
的用法示例。
在下文中一共展示了ofstream::fill方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
void ContractLineRec::dump(ofstream &of) const
{
of.width(2);
char fc = of.fill('0');
of << ContractLine
<< Date
<< PostingCode
<< Contract;
RecordFactory::DumpDouble(of, Amount);
RecordFactory::DumpDouble(of, Discount);
of << RefNum
<< SvcAddr
<< CoveragePeriod
<< RenewalPeriod
<< ConsecutiveMonthsLeft
<< ConsecutiveMonthsTotal;
RecordFactory::DumpDouble(of, Deviation);
of.width(3);
of << Location
<< '\n';
of.fill(fc);
}
示例2: ReportCrashInfo
extern void ReportCrashInfo(ofstream& dump, EXCEPTION_POINTERS* exp)
{
dump << "---------------------------------------------------------------------------------------------------\n";
// report when exception occured
dump.fill('0');
SYSTEMTIME st;
::GetLocalTime(&st);
dump << st.wYear << '-' << setw(2) << st.wMonth << '-' << setw(2) << st.wDay << ' ' <<
setw(2) << st.wHour << ':' << setw(2) << st.wMinute << ':' << setw(2) << st.wSecond << '.' << st.wMilliseconds;
dump << '\n';
// app version
string app;
WideStringToMultiByte(GetAppIdentifier(true), app);
dump << app << '\n';
// dump exception information
if (exp)
dump << DumpExceptionInfo(exp) << '\n';
dump << DumpMemoryStatus() << '\n';
// and call stack
if (exp)
dump << DumpTheStack(exp->ContextRecord) << endl;
}
示例3: dumpNew
void TrailerRec::dumpNew(ofstream &of, int dumpCount, double dump_stmt_bal) const
{
of.width(2);
char fc = of.fill('0');
of << Trailer;
time_t tt = time(0);
struct tm *t = localtime(&tt);
char timebuf[14+1];
strftime(timebuf, sizeof(timebuf), "%m%d%y%I:%M %p", t);
of << timebuf;
of.fill(' ');
of.width(7);
of << dumpCount;
of.fill('0');
RecordFactory::DumpDouble(of, dump_stmt_bal, 10);
of << '\n';
of.fill(fc);
}
示例4:
/** writes the genotype of the individual to the stream (for multiple instances of the same trait)*/
void FileHandler::FHwriteIndividual2Stream(ofstream& FILE, Individual* ind, const int& ploidy, const int& position){
int nb_locus;
unsigned char** seq;
for(int t=0; t<_nb_trait; ++t){
nb_locus = _trait[t]->get_nb_locus();
seq = (unsigned char**)ind->getTrait(_TTidx[t])->get_sequence();
for(int k = 0; k < nb_locus; ++k) {
for (int l = 0; l < ploidy; ++l) {
FILE.fill('0');
FILE.width(position);
FILE<<(unsigned int)(seq[k][l]+1);
}
FILE<<" ";
}
}
}
示例5: writeModel
void GeometryExportFile::writeModel( Object *o, ofstream &out )
{
out <<
"{ 'MODL'\n"
" { 'SRC' \"Innovation 3D exported by WF geometry exporter V0.11\""
" }\n"
" { 'TRGT' \"World Foundy Game Engine (www.worldfoundry.org)\"\n"
" }\n" << endl;
out <<
" { 'NAME' \"" << o->getName() << "\"\n"
" }\n";
out.setf(std::ios::showpoint);
//Vector4 pos;
float texturex=0;
float texturey=0;
float color=0;
//pos = o->getPosition();
int oldWidth = out.width(8);
char oldFill = out.fill('0');
// kts i3d is a left handed coordinate system with positive y up, WF is left handed with positive z up
// so I rotate -90 degrees around x putting y up (swap y&z, negate the new y)
VertexList *vlist = o->getVerts();
int size = (int)vlist->size();
Vector4 vertpos;
Vector4 uv;
for(int i=0; i<size; i++)
{
vertpos = (*vlist)[i]->getPosition();
VertexAndUV vuv;
vuv.position = vertpos;
}
CreateVertUVList(o);
WriteVertexList(out);
out << " { 'MATL' //flags: [FLAT_SHADED=0, GOURAUD_SHADED=1] [SOLID_COLOR=0, TEXTURE_MAPPED=2] [SINGLE_SIDED=0, TWO_SIDED=8]" << endl;
//save materials here.
ObjectDB *odb = I3D::getDB();
TextureMaterial *m;
for(int materialIndex=0; materialIndex<odb->numMaterials(); materialIndex++)
{
m = odb->getMaterial(materialIndex);
_MaterialOnDisk mod;
mod._materialFlags = 0;
if(m->enable_texture)
mod._materialFlags |= TEXTURE_MAPPED;
for(int temp=0;temp<MATERIAL_NAME_LEN;temp++)
mod.textureName[temp] = 0;
if(m->texture)
strncpy(mod.textureName, m->texture->getFilename()->ascii(), MATERIAL_NAME_LEN);
mod.textureName[MATERIAL_NAME_LEN-1] = 0; // make sure it is 0 terminated
mod._color = ((((unsigned int)m->cDiffuse.r)<<16) |
(((unsigned int)m->cDiffuse.g)<<8) |
((unsigned int)m->cDiffuse.b));
out << " //Material " << materialIndex << ": flags: " << mod._materialFlags << ", color: " << hex << mod._color << dec << ", texturename: \"" << mod.textureName << "\"" << endl;
out << " ";
for(int index=0;index<sizeof(_MaterialOnDisk);index++)
{
out << (unsigned int)(((unsigned char*)&mod)[index]) << "y ";
}
out << " // #" << materialIndex << endl;
}
out << " }" << endl;
// faces
size = (int)o->numFaces();
out << " { 'FACE' // count = " << size << endl;
for(int faceIndex=0; faceIndex<size; faceIndex++)
{
Face* face = o->getFace(faceIndex);
vector<int> *vlist = face->getVerts();
vector<int> *uvlist = face->getUVs();
assert(vlist->size() >= 3); // must be at least a triangle
// output list of triangles for this face
//.........这里部分代码省略.........