本文整理汇总了C++中readLong函数的典型用法代码示例。如果您正苦于以下问题:C++ readLong函数的具体用法?C++ readLong怎么用?C++ readLong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readLong函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxConfig
void Mega8Config::loadConfig(const wxString &profile)
{
bool isNew;
if (_config == NULL) {
_config = new wxConfig(wxT("Mega8"), wxT("Ready4Next"));
if (!readBool(wxT("FirstInit"))) {
resetConfig();
writeBool(wxT("FirstInit"), true);
saveConfig(profile);
}
}
_currentProfile = profile;
isNew = loadKeyboard(profile);
_LastFolder = readString(wxT("LastFolder"));
_FullScreen = readBool(wxT("FullScreen"));
_SpeedAuto = readBool(wxT("SpeedAuto"));
_DisplayHUD = readBool(wxT("DisplayHUD"));
_Filtered = readBool(wxT("Filtered"));
_Sound = readBool(wxT("Sound"));
_UseSleep = readBool(wxT("UseSleep"));
_SyncClock = readBool(wxT("SyncClock"));
_ColorTheme = (Chip8ColorTheme)readLong(wxT("ColorTheme"));
_InverseColor = readBool(wxT("InverseColor"));
for (int i = 0; i <= sizeof(Chip8Types); i++) {
_FrequencyRatio[i] = (long)min((long)max((long)readLong(wxT("FrequencyRatio/") + getMachineTypeStr((Chip8Types) i)), (long)4), (long)9);
}
// Save this profile if new
if (isNew) {
saveConfig(profile);
}
}
示例2: readLong
//---------------------------------------------------------------------------
int32_t PacketFile::afterOpen(void)
{
if(!numPackets && getLength() >= 12)
{
int32_t firstPacketOffset;
int32_t firstCheck = readLong();
if(firstCheck == PACKET_FILE_VERSION && !usesCheckSum)
{
}
else
{
//---------------------------------------
// This is probably a checksum. Check it
int32_t checkSum = checkSumFile();
if(checkSum != firstCheck)
return PACKET_OUT_OF_RANGE;
}
firstPacketOffset = readLong();
numPackets = (firstPacketOffset / sizeof(int32_t)) - 2;
}
currentPacket = -1;
if(fileMode == READ || fileMode == RDWRITE)
{
if(numPackets && !seekTable)
{
seekTable = (int32_t*)systemHeap->Malloc(numPackets * sizeof(int32_t));
gosASSERT(seekTable != nullptr);
seek(sizeof(int32_t) * 2); //File Version & File Length
read(puint8_t(seekTable), (numPackets * sizeof(int32_t)));
}
}
return(NO_ERROR);
}
示例3: readITimerSpec
/* $(itimerspec) */
void readITimerSpec( TAInputStream * stream, struct itimerspec * value ) {
verifyType_TAInputStream( stream, "itimerspec" );
value->it_value .tv_sec = readLong( stream );
value->it_value .tv_nsec = readLong( stream );
value->it_interval.tv_sec = readLong( stream );
value->it_interval.tv_nsec = readLong( stream );
}
示例4: readTimeValPair
void readTimeValPair(TAInputStream* stream, struct timeval* times)
{
verifyType_TAInputStream(stream,"timeval_list");
times[0].tv_sec=readLong(stream);
times[0].tv_usec=readLong(stream);
times[1].tv_sec=readLong(stream);
times[1].tv_usec=readLong(stream);
}
示例5: readLong
void FileAllocator::read_node(FileOffset offset, list_node *node)
{
if (! (fseek(f, offset, SEEK_SET) == 0 &&
readLong(f, &node->bytes) &&
readLong(f, &node->prev) &&
readLong(f, &node->next)))
throw GenericException(__FILE__, __LINE__,
"FileAllocator node read at 0x%08lX failed",
(unsigned long)offset);
}
示例6: readUTimBuf
struct utimbuf readUTimBuf(TAInputStream* stream)
{
struct utimbuf res;
verifyType_TAInputStream(stream,"utimbuf");
res.actime=readLong(stream);
res.modtime=readLong(stream);
return res;
}
示例7: readShort
UserEnums::URType
RouteStorageGetRouteReplyPacket::getUrmask() const {
int pos = endStatic_POS;
pos += readShort( strlenExtraUserinfo_POS ) + 1;
pos += readLong( routePackLength_POS );
pos += readLong( driverPrefSize_POS );
UserEnums::URType urmask;
urmask.load( this, pos );
return urmask;
}
示例8: parse
HRESULT PsfParser::parse() {
STATSTG streamStat;
ULONG bytesRead;
HRESULT hresult;
hresult=stream->Stat(&streamStat,STATFLAG_NONAME);
retIfFail;
if(streamStat.cbSize.QuadPart<MIN_PCF_SIZE) {
return E_INVALIDARG;
}
LARGE_INTEGER seekPos;
seekPos.QuadPart=0;
hresult=stream->Seek(seekPos,STREAM_SEEK_SET,nullptr);
retIfFail;
CHAR fileSig[3];
hresult=stream->Read(fileSig,3,&bytesRead);
retIfNonOk;
if(strcmp(fileSig,"PSF")!=0) return E_INVALIDARG;
hresult=stream->Read(&version,1,&bytesRead);
retIfNonOk;
uint32_t reservatedLength,compressedLength,compressedCrc;
hresult=readLong(reservatedLength);
retIfNonOk;
hresult=readLong(compressedLength);
retIfNonOk;
hresult=readLong(compressedCrc);
retIfNonOk;
seekPos.QuadPart=reservatedLength+compressedLength;
hresult=stream->Seek(seekPos,STREAM_SEEK_CUR,nullptr);
retIfFail;
CHAR tagSig[5];
hresult=stream->Read(tagSig,5,&bytesRead);
retIfFail;
if(hresult==S_FALSE) return S_FALSE;
if(strcmp(tagSig,"[TAG]")!=0) return E_INVALIDARG;
seekPos.QuadPart=0;
hresult=stream->Seek(seekPos,STREAM_SEEK_CUR,&tagStart);
retIfFail;
return parseTags();
}
示例9: return
//---------------------------------------------------------------------------
long PacketFile::seekPacket (long packet)
{
long offset, next;
if (packet < 0)
{
return(PACKET_OUT_OF_RANGE);
}
offset = readPacketOffset(packet, &packetType);
currentPacket = packet++;
if (packet == numPackets)
next = getLength();
else
next = readPacketOffset(packet);
packetSize = next-offset;
packetBase = offset; // seek to beginning of packet
seek(packetBase);
switch (getStorageType())
{
case STORAGE_TYPE_LZD:
// the first DWORD of a compressed packet is the unpacked length
packetUnpackedSize = readLong();
break;
case STORAGE_TYPE_ZLIB:
// the first DWORD of a compressed packet is the unpacked length
packetUnpackedSize = readLong();
break;
case STORAGE_TYPE_RAW:
packetUnpackedSize = packetSize;
break;
case STORAGE_TYPE_NUL:
packetUnpackedSize = 0;
break;
default:
return(BAD_PACKET_VERSION);
}
if (offset > 0)
return(NO_ERR);
return (PACKET_OUT_OF_RANGE);
}
示例10: readTimeVal
/* $(timeval) */
int readTimeVal( TAInputStream * stream, struct timeval * value )
{
if(startsWith_TAInputStream(stream, "null:"))
{
shift_TAInputStream(stream, 5);
return 0;
}
verifyType_TAInputStream( stream, "timeval" );
value->tv_sec = readLong( stream );
value->tv_usec = readLong( stream );
return 1;
}
示例11: readLong
bool ZLZipHeader::readFrom(ZLInputStream &stream) {
size_t startOffset = stream.offset();
Signature = readLong(stream);
Version = readShort(stream);
Flags = readShort(stream);
CompressionMethod = readShort(stream);
ModificationTime = readShort(stream);
ModificationDate = readShort(stream);
CRC32 = readLong(stream);
CompressedSize = readLong(stream);
UncompressedSize = readLong(stream);
NameLength = readShort(stream);
ExtraLength = readShort(stream);
return (Signature == 0x04034B50) && (stream.offset() == startOffset + 30) && (NameLength != 0);
}
示例12: readByte
unsigned long chunkArchive::readAny(unsigned char *type, unsigned long *size)
{
unsigned char id = readByte();
if (type)
*type = id;
switch ((atoms) (id)) {
case CHUNK_BYTE:
if (size)
*size = 1;
return readByte();
break;
case CHUNK_SHORT:
if (size)
*size = 2;
return readShort();
break;
case CHUNK_LONG:
if (size)
*size = 4;
return readLong();
break;
case CHUNK_STRING:
return (unsigned long) readString(size);
break;
case CHUNK_BINARY:
return (unsigned long) readBinary(size);
break;
default:
if (size)
*size = 0;
return 0;
}
}
示例13: getLength
//---------------------------------------------------------------------------
void PacketFile::atClose(void)
{
if(isOpen() && fileMode != READ) // update filesize
{
int32_t endPtr = getLength();
//seek(sizeof(int32_t)); //Move Past Version Marker
//writeLong(endPtr); //Write File length
int32_t tableEntry;
currentPacket = numPackets;
if(!seekTable)
{
while(--currentPacket >= 0)
{
seek(TABLE_ENTRY(currentPacket));
tableEntry = readLong();
if(GetPacketType(tableEntry) == STORAGE_TYPE_NUL)
{
seek(TABLE_ENTRY(currentPacket));
writeLong(SetPacketType(endPtr, STORAGE_TYPE_NUL));
}
else
{
endPtr = GetPacketOffset(tableEntry);
}
}
}
else
{
while(--currentPacket >= 0)
{
tableEntry = seekTable[currentPacket];
if(GetPacketType(tableEntry) == STORAGE_TYPE_NUL)
{
seekTable[currentPacket] = SetPacketType(endPtr, STORAGE_TYPE_NUL);
}
else
{
endPtr = GetPacketOffset(tableEntry);
}
}
}
//-----------------------------------------------------
// If seekTable was being used, write it back to file
if(seekTable)
{
seek(sizeof(int32_t) * 2); //File Version & File Length
write(puint8_t(seekTable), (numPackets * sizeof(int32_t)));
}
//------------------------------------------------------
// Is we were using a checkSum, calc it and write it to
// the beginning of the file.
if(usesCheckSum)
{
int32_t checkSum = checkSumFile();
seek(0);
writeLong(checkSum);
}
}
clear();
}
示例14: main
int main()
{
int dia, mes, anio;
long int fecha;
writeLnString("ingrese la fecha en formato AAAAMMDD");
readLong(fecha);
anio = fecha/10000;
fecha -= anio * 10000;
mes = fecha/100;
fecha -= mes * 100;
dia = fecha;
writeString("La Fecha es ");
writeInteger(dia);
writeString("/");
writeInteger(mes);
writeString("/");
writeInteger(anio);
return 0;
}
示例15: va_start
void ByteStream::readFormat(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
while (*fmt) {
const char typeID = *fmt++;
switch (typeID) {
case 'b':
*va_arg(ap, int *) = readByte();
break;
case 's':
*va_arg(ap, int *) = readShort();
break;
case 'i':
*va_arg(ap, int *) = readInt();
break;
case 'l':
*va_arg(ap, long *) = readLong();
break;
default:
core_assert(false);
}
}
va_end(ap);
}