int FileSystem::addInformationToFile() {//Обозначаем переменные string FileName; int InformationCount;//Кол-во добавляемой информации, int CountLength=8; int resultCode = 1; int lenCritical = 48; int CntCritical = 2 ^ 16; //int BlockNf, SegmNf, BlockNs, SegmNs; //Номер блока , номер сегмента FileDescriptor AddFile; FileDescriptor NextFile; //FileDescriptor LastFile; int ResultCount; int freeSpace; //кол-во свободных блоков перед следующим файлом int RecordNumber,NextRecordNumber; //Номер изменяемой записи, номер следующей записи int i; //Счетчик //Собствено функция cout << "Введите имя файла" << endl; cin >> FileName; if (getRecordNumber(FileName)==0)//Проверка ввода имени return(1); cout << "Введите кол-во добавляемой информации" << endl; cin >> InformationCount; InformationCount=InformationCount/512+1; AddFile = getRecord(FileName); if ((AddFile.descriptorType) == "0010000000000000") //!!!!!!!в дескрипторе число блоков сделал интом!!!!!! return(1); RecordNumber=getRecordNumber(FileName); NextRecordNumber=RecordNumber+1; NextFile=getRecord(NextRecordNumber); if ((toInt(AddFile.firstBlockNumber) + AddFile.blockCount + InformationCount) > (toInt(NextFile.firstBlockNumber))) { //LastFile=AddFile; //LastFile.blockCount+=InformationCount; AddFile.blockCount+=InformationCount; for(i=217;((getRecord(i).fileType)=="");i--) //LastFile.firstBlockNumber=toString((toInt(getRecord(i).firstBlockNumber)+getRecord(i).blockCount+1),8); AddFile.firstBlockNumber=toString((toInt(getRecord(i).firstBlockNumber)+getRecord(i).blockCount+1),8); deleteRecord(FileName); //writeRecord(LastFile); writeRecord(AddFile); resultCode=0; } else { AddFile.blockCount=(AddFile.blockCount+InformationCount); deleteRecord(FileName); writeRecord(AddFile,RecordNumber); resultCode=0; } return(resultCode); };
static void addNewGui_guifont() { UInt8 guifont[] = { 0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7, 7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,7,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0, 0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12, 24,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,237,74,72,0,0,0,0,0,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,60,66,153,161,161,153,66,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,96,96,96,96,0,0,96,0,102,102,102,0,0,0,0,0,102,102,255,102,255,102,102,0,24,62,96,60,6,124,24,0,98,102,12,24,48,102,70,0,60,102,60,56,103,102,63,0,96,48,16,0,0,0,0,0,24,48,96,96,96,48,24,0,96,48,24,24,24,48,96,0, 0,102,60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,48,48,96,0,0,0,126,0,0,0,0,0,0,0,0,0,96,96,0,0,3,6,12,24,48,96,0,60,102,102,102,102,102,60,0,24,24,56,24,24,24,126,0,60,102,6,12,48,96,126,0,60,102,6,28,6,102,60,0,6, 14,30,102,127,6,6,0,126,96,124,6,6,102,60,0,60,102,96,124,102,102,60,0,126,102,12,24,24,24,24,0,60,102,102,60,102,102,60,0,60,102,102,62,6,102,60,0,0,0,96,0,0,96,0,0,0,0,48,0,0,48,48,96,14,24,48,96,48,24,14,0,0,0,120,0,120,0,0,0,112,24, 12,6,12,24,112,0,60,102,6,12,24,0,24,0,0,0,0,255,255,0,0,0,24,60,102,126,102,102,102,0,124,102,102,124,102,102,124,0,60,102,96,96,96,102,60,0,120,108,102,102,102,108,120,0,126,96,96,120,96,96,126,0,126,96,96,120,96,96,96,0,60,102,96,110,102,102,60,0,102,102,102, 126,102,102,102,0,120,48,48,48,48,48,120,0,30,12,12,12,12,108,56,0,102,108,120,112,120,108,102,0,96,96,96,96,96,96,126,0,99,119,127,107,99,99,99,0,102,118,126,126,110,102,102,0,60,102,102,102,102,102,60,0,124,102,102,124,96,96,96,0,60,102,102,102,102,60,14,0,124,102,102,124, 120,108,102,0,60,102,96,60,6,102,60,0,126,24,24,24,24,24,24,0,102,102,102,102,102,102,60,0,102,102,102,102,102,60,24,0,99,99,99,107,127,119,99,0,102,102,60,24,60,102,102,0,102,102,102,60,24,24,24,0,126,6,12,24,48,96,126,0,120,96,96,96,96,96,120,0,3,6,12,24,48, 96,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24, 24,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96, 96,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0, 24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,97,153,134,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48, 24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0, 0,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102, 102,102,102,60,0,102,0,102,102,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0 }; writeRecord(guifont, sizeof(guifont), GBVARS_GUIFONT_INDEX, GBVARS_COMMON); }
// Reset variables for each file. void GlfFile::resetFile() { // Close the file. if (myFilePtr != NULL) { // If we already have an open file, close it. // First check to see if an end record needs to be written, which // is the case if the state is RECORD. if(myNextSection == RECORD) { if(!writeRecord(myEndMarker)) { // Failed to write the end marker record. myStatus.setStatus(GlfStatus::FAIL_IO, "Failed to write end of chromosome/section marker."); throw(GlfException(myStatus)); } } ifclose(myFilePtr); myFilePtr = NULL; } myIsOpenForRead = false; myIsOpenForWrite = false; myRecordCount = 0; myStatus = GlfStatus::SUCCESS; myNextSection = HEADER; }
static void PlayerV2_freqmod_offsets() { UInt16 freqmod_offsets[] = { 0, 0x100, 0x200, 0x302, 0x202 }; writeRecord(freqmod_offsets, sizeof(freqmod_offsets), GBVARS_FREQMODOFFSETS_INDEX , GBVARS_SCUMM); }
int main(void){ char* map = initMap(); banner(map); int input = 0; int turn; for(turn=5; turn != 0; turn-- ){ printf("Dein Zug: "); if(scanf("%d", &input) <= 0){ printf("\nFehler bei der Eingabe!\n"); while(getchar() != '\n'); turn++; continue; } if(setMap(map, input) == 0){ if(check(map) != 0) break; outMap(map); printf("Gegner ist am Zug:\n"); setNPC(map); outMap(map); if(check(map) != 0) break; } else{ turn++; } } printf("Der Sieger ist...\n"); //Das kann man bestimmt auch besser machen.. int result = check(map); if(result == 0) printf("Niemand\n"); else if(result == 1) printf("Der Spieler\n"); else if(result == 2) printf("Der Computer\n"); free(map); writeRecord(result); return 0; }
static void PlayerV2_freqmod_lengths() { UInt16 freqmod_lengths[] = { 0x1000, 0x1000, 0x20, 0x2000, 0x1000 }; writeRecord(freqmod_lengths, sizeof(freqmod_lengths), GBVARS_FREQMODLENGTHS_INDEX , GBVARS_SCUMM); }
void IntersectBed::pushRoi(TRoiRecord const & roiRecord) { if (options.verbosity >= 2) { std::cerr << "pushRoi()\n" << " "; writeRecord(std::cerr, roiRecord, seqan::Roi()); } // Handle contig transition, we can unconditionally update ref. if (roiRecord.ref != ref) finishContig(); ref = roiRecord.ref; // Complete processing all BED records that cannot overlap with roiRecord. After removing each BED record, remove // all ROI records that do not overlap with first BED record any more. while (!bedRecords.empty() && bedRecords.front().endPos <= roiRecord.beginPos) { processFirstBedRecord(); bedRecords.pop_front(); cleanRoiRecords(); } // Finally, register ROI records. roiRecords.push_back(roiRecord); // Mark ROI record as not touched yet. We do this using the data entry. appendValue(roiRecords.back().data, "."); }
void ProjectSplicedRoi::pushGff(seqan::GffRecord const & record) { if (verbosity >= 3) { std::cerr << "Pushing GFF record.\n "; writeRecord(std::cerr, const_cast<seqan::GffRecord &>(record), seqan::Gff()); } gffRecords.push_back(record); // Get string set of group names for the record. seqan::StringSet<seqan::CharString> groups; for (unsigned i = 0; i < length(record.tagNames); ++i) if (record.tagNames[i] == groupBy) { strSplit(groups, record.tagValues[i], seqan::EqualsChar<','>()); break; } gffGroups.push_back(groups); if (verbosity >= 3) { std::cerr << "Groups:"; for (unsigned i = 0; i < length(groups); ++i) std::cerr << " " << groups[i]; std::cerr << "\n"; } }
/** * Deletes a record from table * * rel = table handle * id = id of the record to be deleted * */ RC deleteRecord(RM_TableData *rel, RID id) { //Sanity Checks if (rel == NULL) { THROW(RC_INVALID_HANDLE, "Table handle is invalid"); } Record *record; //Read the record to be deleted createRecord(&record, rel->schema); RC rc = readRecord(rel, id, &record); if (rc != RC_OK) { THROW(RC_REC_MGR_DELETE_REC_FAILED, "Delete record failed"); } //Set tomstone bit record->nullMap |= 1 << 15; //Write updated record rc = writeRecord(rel, record); freeRecord(record); if (rc == RC_OK) ((RM_TableMgmtData *) rel->mgmtData)->tupleCount--; else { THROW(RC_REC_MGR_DELETE_REC_FAILED, "Delete record failed"); } return rc; }
static void onMenuSelectIssue(void) { playSoundClick(); writeRecord(); state = STATE_ISSUES; isInvalid = true; }
void ProjectSplicedRoi::purgeGffAndRoiRecords() { if (verbosity >= 3) std::cerr << "Purging GFF and ROI records.\n" << " current group: " << ranges[currentGroup].i1 << ", " << ranges[currentGroup].i2 << "\n"; typedef std::list<seqan::GffRecord>::iterator TGffIter; typedef std::list<seqan::StringSet<seqan::CharString> >::iterator TGroupsIter; TGroupsIter itG = gffGroups.begin(); for (TGffIter it = gffRecords.begin(); it != gffRecords.end();) if ((int)it->endPos <= ranges[currentGroup].i1) { if (verbosity >= 3) { std::cerr << "Purging\t"; writeRecord(std::cerr, *it, seqan::Gff()); } TGffIter itE = it++; gffRecords.erase(itE); TGroupsIter itEG = itG++; gffGroups.erase(itEG); } else { ++it; ++itG; } for (TGffIter it = gffRecords.begin(); it != gffRecords.end(); ++it) SEQAN_ASSERT_GT((int)it->endPos, ranges[currentGroup].i1); typedef std::list<seqan::RoiRecord>::iterator TRoiIter; for (TRoiIter it = roiRecords.begin(); it != roiRecords.end();) if (it->endPos <= ranges[currentGroup].i1) { if (verbosity >= 3) { std::cerr << "Purging\t"; writeRecord(std::cerr, *it, seqan::Roi()); } TRoiIter itE = it++; roiRecords.erase(itE); } else { ++it; } }
static void PlayerV2_spk_freq_table() { UInt16 spk_freq_table[12] = { 36484, 34436, 32503, 30679, 28957, 27332, 25798, 24350, 22983, 21693, 20476, 19326 }; writeRecord(spk_freq_table, sizeof(spk_freq_table), GBVARS_SPKFREQTABLE_INDEX , GBVARS_SCUMM); }
void MDNS::writeNSECHostRecord() { writeRecord(HOST_NAME, NSEC_TYPE, TTL_2MIN); buffer->writeUInt16(5); labels[HOST_NAME]->write(buffer); buffer->writeUInt8(0); buffer->writeUInt8(1); buffer->writeUInt8(0x40); }
void MDNS::writeSRVRecord() { writeRecord(INSTANCE_NAME, SRV_TYPE, TTL_2MIN); buffer->writeUInt16(6 + labels[HOST_NAME]->getWriteSize()); buffer->writeUInt16(0); buffer->writeUInt16(0); buffer->writeUInt16(port); labels[HOST_NAME]->write(buffer); }
void MDNS::writeARecord() { writeRecord(HOST_NAME, A_TYPE, TTL_2MIN); buffer->writeUInt16(4); IPAddress ip = WiFi.localIP(); for (int i = 0; i < IP_SIZE; i++) { buffer->writeUInt8(ip[i]); } }
static void PlayerV2_pcjr_freq_table() { UInt16 pcjr_freq_table[12] = { 65472, 61760, 58304, 55040, 52032, 49024, 46272, 43648, 41216, 38912, 36736, 34624 }; writeRecord(pcjr_freq_table, sizeof(pcjr_freq_table), GBVARS_PCJRFREQTABLE_INDEX , GBVARS_SCUMM); }
int main(int argc, char const ** argv) { //parse our options ModifyStringOptions options; seqan::ArgumentParser::ParseResult res = parseCommandLine(options, argc, argv); // If parsing was not successful then exit with code 1 if there were errors. // Otherwise, exit with code 0 (e.g. help was printed). if (res != seqan::ArgumentParser::PARSE_OK) return res == seqan::ArgumentParser::PARSE_ERROR; SeqFileIn seqFileIn; if (!open(seqFileIn, toCString(options.inputFileName))) { std::cerr << "ERROR: Could not open the file.\n"; return 1; } CharString id; Dna5String seq; CharString qual; SeqFileOut seqFileOut; if (!open(seqFileOut, toCString(options.outputFileName))) { std::cerr << "ERROR: Could not open the file.\n"; return 1; } while(!atEnd(seqFileIn)) { try { readRecord(id, seq, qual, seqFileIn); } catch (Exception const & e) { std::cout << "ERROR: " << e.what() << std::endl; return 1; } if(length(seq) >= options.length) { String<Dna> dnaSeq; resize(dnaSeq, options.length, Exact()); assign(dnaSeq, seq, Limit()); CharString dnaQual; resize(dnaQual, options.length, Exact()); assign(dnaQual, qual, Limit()); writeRecord(seqFileOut, id, dnaSeq, dnaQual); } } return 0; }
void EventRecorder::deinit() { debug(3, "EventRecorder: deinit"); g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); g_system->lockMutex(_timeMutex); g_system->lockMutex(_recorderMutex); _recordMode = kPassthrough; g_system->unlockMutex(_timeMutex); g_system->unlockMutex(_recorderMutex); delete _playbackFile; delete _playbackTimeFile; if (_recordFile != NULL) { _recordFile->finalize(); delete _recordFile; _recordTimeFile->finalize(); delete _recordTimeFile; _playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName); assert(_playbackFile); _recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName); _recordFile->writeUint32LE(RECORD_SIGNATURE); _recordFile->writeUint32LE(RECORD_VERSION); // conf vars _recordFile->writeByte(_recordSubtitles ? 1 : 0); _recordFile->writeUint32LE(_recordCount); _recordFile->writeUint32LE(_recordTimeCount); _recordFile->writeUint32LE(_randomSourceRecords.size()); for (uint i = 0; i < _randomSourceRecords.size(); ++i) { _recordFile->writeUint32LE(_randomSourceRecords[i].name.size()); _recordFile->writeString(_randomSourceRecords[i].name); _recordFile->writeUint32LE(_randomSourceRecords[i].seed); } for (uint i = 0; i < _recordCount; ++i) { uint32 tempDiff; Event tempEvent; uint32 millis; readRecord(_playbackFile, tempDiff, tempEvent, millis); writeRecord(_recordFile, tempDiff, tempEvent, millis); } _recordFile->finalize(); delete _recordFile; delete _playbackFile; //TODO: remove recordTempFileName'ed file } }
static void PlayerV2_hull_offsets() { UInt16 hull_offsets[] = { 0, 12, 24, 36, 48, 60, 72, 88, 104, 120, 136, 256, 152, 164, 180 }; writeRecord(hull_offsets, sizeof(hull_offsets), GBVARS_HULLOFFSETS_INDEX , GBVARS_SCUMM); }
static void addCodec47_codec47_table() { Int8 codec47_table[] = { 0, 0, -1, -43, 6, -43, -9, -42, 13, -41, -16, -40, 19, -39, -23, -36, 26, -34, -2, -33, 4, -33, -29, -32, -9, -32, 11, -31, -16, -29, 32, -29, 18, -28, -34, -26, -22, -25, -1, -25, 3, -25, -7, -24, 8, -24, 24, -23, 36, -23, -12, -22, 13, -21, -38, -20, 0, -20, -27, -19, -4, -19, 4, -19, -17, -18, -8, -17, 8, -17, 18, -17, 28, -17, 39, -17, -12, -15, 12, -15, -21, -14, -1, -14, 1, -14, -41, -13, -5, -13, 5, -13, 21, -13, -31, -12, -15, -11, -8, -11, 8, -11, 15, -11, -2, -10, 1, -10, 31, -10, -23, -9, -11, -9, -5, -9, 4, -9, 11, -9, 42, -9, 6, -8, 24, -8, -18, -7, -7, -7, -3, -7, -1, -7, 2, -7, 18, -7, -43, -6, -13, -6, -4, -6, 4, -6, 8, -6, -33, -5, -9, -5, -2, -5, 0, -5, 2, -5, 5, -5, 13, -5, -25, -4, -6, -4, -3, -4, 3, -4, 9, -4, -19, -3, -7, -3, -4, -3, -2, -3, -1, -3, 0, -3, 1, -3, 2, -3, 4, -3, 6, -3, 33, -3, -14, -2, -10, -2, -5, -2, -3, -2, -2, -2, -1, -2, 0, -2, 1, -2, 2, -2, 3, -2, 5, -2, 7, -2, 14, -2, 19, -2, 25, -2, 43, -2, -7, -1, -3, -1, -2, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 10, -1, -5, 0, -3, 0, -2, 0, -1, 0, 1, 0, 2, 0, 3, 0, 5, 0, 7, 0, -10, 1, -7, 1, -3, 1, -2, 1, -1, 1, 0, 1, 1, 1, 2, 1, 3, 1, -43, 2, -25, 2, -19, 2, -14, 2, -5, 2, -3, 2, -2, 2, -1, 2, 0, 2, 1, 2, 2, 2, 3, 2, 5, 2, 7, 2, 10, 2, 14, 2, -33, 3, -6, 3, -4, 3, -2, 3, -1, 3, 0, 3, 1, 3, 2, 3, 4, 3, 19, 3, -9, 4, -3, 4, 3, 4, 7, 4, 25, 4, -13, 5, -5, 5, -2, 5, 0, 5, 2, 5, 5, 5, 9, 5, 33, 5, -8, 6, -4, 6, 4, 6, 13, 6, 43, 6, -18, 7, -2, 7, 0, 7, 2, 7, 7, 7, 18, 7, -24, 8, -6, 8, -42, 9, -11, 9, -4, 9, 5, 9, 11, 9, 23, 9, -31, 10, -1, 10, 2, 10, -15, 11, -8, 11, 8, 11, 15, 11, 31, 12, -21, 13, -5, 13, 5, 13, 41, 13, -1, 14, 1, 14, 21, 14, -12, 15, 12, 15, -39, 17, -28, 17, -18, 17, -8, 17, 8, 17, 17, 18, -4, 19, 0, 19, 4, 19, 27, 19, 38, 20, -13, 21, 12, 22, -36, 23, -24, 23, -8, 24, 7, 24, -3, 25, 1, 25, 22, 25, 34, 26, -18, 28, -32, 29, 16, 29, -11, 31, 9, 32, 29, 32, -4, 33, 2, 33, -26, 34, 23, 36, -19, 39, 16, 40, -13, 41, 9, 42, -6, 43, 1, 43, 0, 0, 0, 0, 0, 0 }; writeRecord(codec47_table, sizeof(codec47_table), GBVARS_CODEC47TABLE_INDEX , GBVARS_SCUMM); }
// Write the reference section to the file. bool GlfFile::writeRefSection(const GlfRefSection& refSection) { if(myIsOpenForWrite == false) { // File is not open for write myStatus.setStatus(GlfStatus::FAIL_ORDER, "Cannot write reference section since the file is not open for writing"); throw(GlfException(myStatus)); return(false); } if(myNextSection == HEADER) { // The header has not been written. myStatus.setStatus(GlfStatus::FAIL_ORDER, "Cannot write reference section since the header has not been written"); throw(GlfException(myStatus)); return(false); } if(myNextSection == RECORD) { // did not write a end marker record, so write one now. if(!writeRecord(myEndMarker)) { // Failed to write the end marker record. myStatus.setStatus(GlfStatus::FAIL_IO, "Failed to write end of chromosome/section marker."); throw(GlfException(myStatus)); return(false); } } if(myNextSection != REF_SECTION) { // Not ready to write a reference section. myStatus.setStatus(GlfStatus::FAIL_IO, "Not ready for a chromosome/section header."); throw(GlfException(myStatus)); return(false); } if(refSection.write(myFilePtr)) { myStatus = GlfStatus::SUCCESS; // A reference section has now been successfully written. myNextSection = RECORD; return(true); } // return the status. myStatus.setStatus(GlfStatus::UNKNOWN, "Failed writing a reference section to the file."); throw(GlfException(myStatus)); return(false); }
int main() { seqan::GffStream out("-", seqan::GffStream::WRITE); // Add sequence names. addSequenceName(out, "ctg123"); // Write out the records. seqan::GffRecord record; record.rID = 0; record.source = ""; record.type = "gene"; record.beginPos = 999; record.endPos = 9000; record.strand = '+'; record.score = seqan::GffRecord::INVALID_SCORE(); appendValue(record.tagName, "ID"); appendValue(record.tagValue, "gene0001"); appendValue(record.tagName, "Name"); appendValue(record.tagValue, "EDEN"); if (writeRecord(out, record) != 0) std::cerr << "ERROR: Problem writing output file."; clear(record.tagName); clear(record.tagValue); record.rID = 0; record.source = ""; record.type = "TF_binding_site"; record.beginPos = 999; record.endPos = 1012; record.strand = '+'; record.score = seqan::GffRecord::INVALID_SCORE(); appendValue(record.tagName, "Parent"); appendValue(record.tagValue, "gene0001"); if (writeRecord(out, record) != 0) std::cerr << "ERROR: Problem writing output file."; return 0; }
void MDNS::writeNSECInstanceRecord() { writeRecord(INSTANCE_NAME, NSEC_TYPE, TTL_2MIN); buffer->writeUInt16(9); labels[INSTANCE_NAME]->write(buffer); buffer->writeUInt8(0); buffer->writeUInt8(5); buffer->writeUInt8(0); buffer->writeUInt8(0); buffer->writeUInt8(0x80); buffer->writeUInt8(0); buffer->writeUInt8(0x40); }
int main(int argc, char *argv[]) { if(dbinit()){ writeRecord("数据库链接成功\n"); }else{ writeRecord("数据库链接失败\n"); exit(EXIT_FAILURE); } pid_t pidd; pidd =fork(); switch(pidd){ case -1: exit(1); case 0: {QApplication a(argc, argv); MainWindow w; w.show(); w.setInit(); std::cout << "ddd\n"; a.exec();} break; default: start_server(); break; } // ticket uuuu={0,"zx","zx","zx","zx","zx",12}; // add_ticket(&uuuu); return 0; //return 1; }
static void PlayerV2_note_lengths() { UInt8 note_lengths[] = { 0, 0, 0, 2, 0, 3, 4, 5, 6, 8, 9, 12, 16, 18, 24, 32, 36, 48, 64, 72, 96 }; writeRecord(note_lengths, sizeof(note_lengths), GBVARS_NOTELENGTHS_INDEX , GBVARS_SCUMM); }
/************************************************************ Open the File. allocate as many pages in the file as the buffer manager would allow, and write the page number into the data. then, close file. ******************************************************************/ writefile(char *fname, int n_pages) { struct Record r; strcpy(r.name, "DBInternals"); strcpy(r.phone, "9831929192"); r.dd = 10; r.mm = 11; r.yy = 12; int page_hdr = 4; int n_tuppp = (PF_PAGE_SIZE - page_hdr) / sizeof(r); int i; int fd,pagenum; int *buf; int error; /* open file1, and allocate a few pages in there */ if ((fd=PF_OpenFile(fname))<0){ PF_PrintError("open file1"); exit(1); } //printf("opened %s\n",fname); for (i=0; i < n_pages; i++){ if ((error=PF_AllocPage(fd,&pagenum,&buf))!= PFE_OK){ PF_PrintError("first buffer\n"); exit(1); } buf[0] = n_tuppp; int j; for( j = 0; j < n_tuppp; ++j){ writeRecord(&r, page_hdr + j * sizeof(r), sizeof(r), buf); } //printf("allocated page %d\n",pagenum); if ((error=PF_UnfixPage(fd,i,TRUE))!= PFE_OK){ PF_PrintError("unfix buffer\n"); exit(1); } PF_PrintError("unfixed page successfully\n"); } /* close the file */ if ((error=PF_CloseFile(fd))!= PFE_OK){ PF_PrintError("close file1\n"); exit(1); } }
int UpdateCardData() { u8 tempData[2000]; if(!initialize()) return 0; if(!selectFile(0xAA, 0x10)) return 0; if(!writeRecord(0x00,0x00,0x15,0x15, (u8*)tempData)) return 0; return 1; }
void IntersectBed::writeEmptyBed(seqan::BedRecord<seqan::Bed6> const & bedRecord) { seqan::RoiRecord roiRecord; roiRecord.ref = bedRecord.ref; roiRecord.beginPos = bedRecord.beginPos; roiRecord.endPos = bedRecord.endPos; roiRecord.strand = bedRecord.strand; roiRecord.name = bedRecord.name; roiRecord.len = roiRecord.endPos - roiRecord.beginPos; roiRecord.countMax = 0; for (int i = 0; i < (int)roiRecord.len; ++i) appendValue(roiRecord.count, 0); writeRecord(roiFileOut, roiRecord); }
void start_server(){ writeRecord("系统启动\n"); int server_sockfd; struct sockaddr_in server_address; server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = inet_addr("127.0.0.1"); server_address.sin_port = 9734; server_sockfd = socket(AF_INET, SOCK_STREAM, 0); bind(server_sockfd, (struct sockaddr *)&server_address, sizeof(server_address)); listen(server_sockfd, 5); writeRecord("server start, waiting client!\n"); while(1){ int client_sockfd; struct sockaddr_in client_address; socklen_t client_addr_len; client_addr_len = sizeof(client_address); client_sockfd = accept(server_sockfd, (struct sockaddr *)&client_address, (socklen_t *)&client_addr_len); writeRecord("client connected\n"); pid_t p; if((p=fork())==0){ close(server_sockfd); while(1){ request rqt; srv_get_request(&rqt, client_sockfd); printf("用户名%s 有一个请求信息\n", rqt.u.name); p_request(&rqt, client_sockfd); } }else if(p > 0){ close(client_sockfd); }else{ } } }
bool EventRecorder::notifyEvent(const Event &ev) { if (_recordMode != kRecorderRecord) return false; StackLock lock(_recorderMutex); ++_eventCount; writeRecord(_recordFile, _eventCount - _lastEventCount, ev, _lastMillis - _lastEventMillis); _recordCount++; _lastEventCount = _eventCount; _lastEventMillis = _lastMillis; return false; }