本文整理汇总了C++中FilePtr::writeLine方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::writeLine方法的具体用法?C++ FilePtr::writeLine怎么用?C++ FilePtr::writeLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::writeLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
//---------------------------------------------------------------------------
long File::open (FilePtr _parent, unsigned long fileSize, long numChild)
{
if (_parent && (_parent->fastFile == NULL))
{
parent = _parent;
if (parent->getFileMode() != READ)
{
return(CANT_WRITE_TO_CHILD);
}
physicalLength = fileSize;
parentOffset = parent->getLogicalPosition();
logicalPosition = 0;
//-------------------------------------------------------------
fileName = parent->getFilename();
fileMode = parent->getFileMode();
handle = parent->getFileHandle();
if (logFileTraffic)
{
if (!fileTrafficLog)
{
createTrafficLog();
}
char msg[300];
sprintf(msg,"CHILD Length: %010d File: %s",fileSize,_parent->getFilename());
fileTrafficLog->writeLine(msg);
}
long result = parent->addChild(this);
if (result != NO_ERR)
return(result);
//------------------------------------------------------------
// NEW FUNCTIONALITY!!!
//
// Each file may have a number of files open as children which
// use the parent's handle for reads and writes. This would
// allow us to open a packet file and read a packet as a fitIni
// or allow us to write a packet as a fit ini and so forth.
//
// It also allows us to use the packet file extensions as tree
// files to avoid the ten thousand file syndrome.
//
// There is now an open which takes a FilePtr and a size.
//
// IF a numChild parameter is passed in as -1, we want this file in RAM!!
// This means NO CHILDREN!!!!!!!!!!!!!
if (numChild != -1)
{
maxChildren = numChild;
childList = (FilePtr *)systemHeap->Malloc(sizeof(FilePtr) * maxChildren);
gosASSERT(childList != NULL);
numChildren = 0;
for (long i=0;i<(long)maxChildren;i++)
{
childList[i] = NULL;
}
}
else
{
maxChildren = 0;
inRAM = TRUE;
unsigned long result = 0;
fileImage = (MemoryPtr)malloc(fileSize);
if (!fileImage)
inRAM = FALSE;
if (_parent->getFileClass() == PACKETFILE)
{
result = ((PacketFilePtr)_parent)->readPacket(((PacketFilePtr)_parent)->getCurrentPacket(),fileImage);
}
else
{
result = _read(handle,fileImage,fileSize);
if (result != fileSize)
lastError = errno;
}
}
}
else
{
return(PARENT_NULL);
}
return(NO_ERR);
}
示例2: saveEXCEL
//******************************************************************************************
long MasterComponent::saveEXCEL (FilePtr componentFile, unsigned char masterId, float baseSensorRange)
{
char dataLine[512];
char piece[512];
char comma[2] = ",";
if (masterID == -1)
{
//---------------------------------------
// Blank undefined line in compbas here.
sprintf(dataLine,"0,undefined,undefined,0,0,0,0,0,0,0,0,0,0,0,0,No,No,0,No,0,0,0,0,na,na,na,na,na,na,na,na,na,,,,,");
componentFile->writeLine(dataLine);
return(0);
}
//----------------------------------------------------------
// Build the dataline piece by piece
sprintf(piece,"%d",masterId);
strcpy(dataLine,piece);
strcat(dataLine,comma);
cLoadString(COMPONENT_NAME_START+masterID,name,MAXLEN_COMPONENT_NAME);
strcat(dataLine,name);
strcat(dataLine,comma);
cLoadString(COMPONENT_ABBR_START+masterID,abbreviation,MAXLEN_COMPONENT_ABBREV);
strcat(dataLine,abbreviation);
strcat(dataLine,comma);
strcat(dataLine,ComponentFormString[form]);
strcat(dataLine,comma);
sprintf(piece,"%d",size);
strcat(dataLine,piece);
strcat(dataLine,comma);
sprintf(piece,"1");
strcat(dataLine,piece);
strcat(dataLine,comma);
sprintf(piece,"%3.1f",tonnage);
strcat(dataLine,piece);
strcat(dataLine,comma);
sprintf(piece,"%d",resourcePoints);
strcat(dataLine,piece);
strcat(dataLine,comma);
for (long location = 0; location < NUM_BODY_LOCATIONS; location++)
{
if (criticalSpacesReq[location] == -1)
sprintf(piece,"No");
else if (criticalSpacesReq[location] == 0)
sprintf(piece,"Yes");
else
Fatal(criticalSpacesReq[location],"Bad Data");
strcat(dataLine,piece);
strcat(dataLine,comma);
}
if (getCanVehicleUse())
sprintf(piece,"Yes");
else
sprintf(piece,"No");
strcat(dataLine,piece);
strcat(dataLine,comma);
if (getCanMechUse())
sprintf(piece,"Yes");
else
sprintf(piece,"No");
strcat(dataLine,piece);
strcat(dataLine,comma);
if (getClanTechBase() && getISTechBase())
{
sprintf(piece,"Both");
}
else if (getClanTechBase())
{
sprintf(piece,"Clan");
}
else if (getISTechBase())
{
sprintf(piece,"IS");
}
else
{
sprintf(piece,"0");
}
strcat(dataLine,piece);
strcat(dataLine,comma);
if (getCanISUse())
sprintf(piece,"Yes");
//.........这里部分代码省略.........