您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ writeFile函数代码示例

51自学网 2021-06-03 10:04:12
  C++
这篇教程C++ writeFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中writeFile函数的典型用法代码示例。如果您正苦于以下问题:C++ writeFile函数的具体用法?C++ writeFile怎么用?C++ writeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了writeFile函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(){    std::stringstream a_foldername;    a_foldername.str( std::string() );    a_foldername.clear();    a_foldername << "calibrationData" << "/" << getDate() << "_" << getTime() << "/";    std::cout << "Folder: " << a_foldername.str() << std::endl;    std::stringstream a_filename;    a_filename.str( std::string() );    a_filename.clear();    a_filename << "pointsGen.csv";    std::cout << "File: " << a_filename.str() << std::endl;    std::string a_filepath = writeFile( a_foldername.str(), a_filename.str() );    readFile( a_filepath );    return 0;}
开发者ID:meilu2two,项目名称:apps,代码行数:20,


示例2: emptyTreeWidget

bool LOCACC::deleteScreen(QTreeWidgetItem *currentItem){    QString screenId = currentItem->text(0);    QJsonArray locArray = m_jsonMasterObj["locAccData"].toArray();    QJsonObject tempObj;    for(int i = 0 ; i < locArray.count() ; i++)    {        tempObj = locArray.at(i).toObject();        if(tempObj["id"] == screenId)        {            locArray.removeAt(i);            break;        }    }    m_jsonMasterObj["locAccData"] = locArray;    currentItem->parent()->removeChild(currentItem);    emptyTreeWidget(currentItem);    writeFile();    return true;}
开发者ID:vihangpatel,项目名称:WatchDog2,代码行数:20,


示例3: main

int main(int argc, char* argv[]){    POINT** points = NULL;    if(argc > 1)    {        points = readFile(argv[1]);        if(points != NULL)        {            display(points,12);            polygon(points, 12);            display(points, 12);            writeFile(points, 13, argv[1]);            destroyPoint(points, 13);        }    }    return 0;}
开发者ID:Orcrist1,项目名称:Programming-Technique,代码行数:20,


示例4: tr

void GaussianBeamWindow::saveFile(const QString& path){	QSettings settings;	QString fileName = path;	QString dir = settings.value("GaussianBeamWindow/lastDirectory", "").toString();	if (fileName.isNull())		fileName = QFileDialog::getSaveFileName(this, tr("Save File"), dir, "*.xml");	if (fileName.isEmpty())		return;	if (!fileName.endsWith(".xml"))		fileName += ".xml";	if (writeFile(fileName))	{		setCurrentFile(fileName);		statusBar()->showMessage(tr("File") + " " + QFileInfo(fileName).fileName() + " " + tr("saved"));		settings.setValue("GaussianBeamWindow/lastDirectory", QFileInfo(fileName).path());	}}
开发者ID:lrunze,项目名称:MyDocuments,代码行数:20,


示例5: kTermWriteFile

static void kTermWriteFile(char *name){	FILE f;	unsigned char buffer[512] = "Let's write a file";	f=openFile(name,'w');	if(f.flags == FS_FILE_INVALID){		print("/r/nFile not found...");		closeFile(&f);		return;	} else if (f.flags== FS_DIRECTORY){		print("/r/n%s is a directory");		closeFile(&f);		return;	}	if(writeFile(&f,buffer,19) > 0)		print("Writing complete/r/n");	closeFile(&f);}
开发者ID:FabrizioPerria,项目名称:JackOS,代码行数:20,


示例6: writeFile

int ShibeTranslator::saveToFile(const QString &fileName){	QStringList resultList;	resultList.append(getMapList(&buttonMap,"Button_"));	resultList.append(getMapList(&labelMap,"Label_"));	resultList.append(getMapList(&checkBoxMap,"CheckBox_"));	resultList.append(getMapList(&groupBoxMap,"GroupBox_"));	resultList.append(getMapList(&spinBoxMap,"SpinBox_"));	resultList.append(getMapList(&stringMap,"String_"));	if(resultList.isEmpty())return 1;	resultList.sort();	QFile writeFile(fileName);	if(writeFile.open(QIODevice::WriteOnly|QIODevice::Truncate))	{		writeFile.write(QString(resultList.join("/r/n")+"/r/n").toUtf8());		writeFile.close();		return 0;	}	return 2;}
开发者ID:TraderShibe,项目名称:TraderShibe,代码行数:20,


示例7: main

int main(int argc, const char * argv[]){    if (argc!=4) {        std::cout<<"patch command parameter:/n oldFileName diffFileName outNewFileName/n";        return 0;    }    const char* oldFileName=argv[1];    const char* diffFileName=argv[2];    const char* outNewFileName=argv[3];    std::cout<<"old :/"" <<oldFileName<< "/"/ndiff:/""<<diffFileName<<"/"/nout :/""<<outNewFileName<<"/"/n";    clock_t time0=clock();    {        std::vector<TByte> diffData; readFile(diffData,diffFileName);        const TUInt diffFileDataSize=(TUInt)diffData.size();        TUInt kNewDataSizeSavedSize=-1;        const hpatch_StreamPos_t _newFileDataSize=readSavedSize(diffData,&kNewDataSizeSavedSize);        const TUInt newDataSize=(TUInt)_newFileDataSize;        if (newDataSize!=_newFileDataSize) exit(1);        std::vector<TByte> oldData; readFile(oldData,oldFileName);        const TUInt oldDataSize=(TUInt)oldData.size();        std::vector<TByte> newData;        newData.resize(newDataSize);        TByte* newData_begin=0; if (!newData.empty()) newData_begin=&newData[0];        const TByte* oldData_begin=0; if (!oldData.empty()) oldData_begin=&oldData[0];        clock_t time1=clock();        if (!patch(newData_begin,newData_begin+newDataSize,oldData_begin,oldData_begin+oldDataSize,                   &diffData[0]+kNewDataSizeSavedSize, &diffData[0]+diffFileDataSize)){            std::cout<<"  patch run error!!!/n";            exit(3);        }        clock_t time2=clock();        writeFile(newData,outNewFileName);        std::cout<<"  patch ok!/n";        std::cout<<"oldDataSize : "<<oldDataSize<<"/ndiffDataSize: "<<diffData.size()<<"/nnewDataSize : "<<newDataSize<<"/n";        std::cout<<"/npatch   time:"<<(time2-time1)*(1000.0/CLOCKS_PER_SEC)<<" ms/n";    }    clock_t time3=clock();    std::cout<<"all run time:"<<(time3-time0)*(1000.0/CLOCKS_PER_SEC)<<" ms/n";    return 0;}
开发者ID:snowdream,项目名称:android-diffpatch,代码行数:41,


示例8: getCachedDirectory

/* * Create a file on the disk */bool Directory::createFile(string path, string name, string &data) {	if (!initialised) throw std::runtime_error("Directory not Initialised");	if (isPathNameLegal(path) && isNameLegal(name)) {		// check the path is valid		int directoryNode = directoryTree->getPathNode(path);		if (directoryNode < 0) {			cout << "path " << path << " is invalid" << endl;			return false;		}		// cache the directory (path) if it is not already cached		int directoryNodeCache = getCachedDirectory(directoryNode);		// check the filename does not already exist		if (cachedDirectory[directoryNodeCache]->cache.count(name) > 0) {			cout << "file/Directory " << name << " already exists" << endl;			freeCachedDirectory(directoryNodeCache);			return false;		}		// create an INode		int fileBlock = freeBlockList->getBlock();		int fileNode = iNodeList->writeNewINode(false,data.length(),fileBlock);		iNodeList->lockINode(fileNode);		// write the file		if (!writeFile(fileNode,data)) {			iNodeList->unLockINode(fileNode);			freeCachedDirectory(directoryNodeCache);			return false;		}		// add the file to the directory		iNodeList->lockINode(directoryNode);		cachedDirectory[directoryNodeCache]->cache.insert({name,fileNode});		// write the directory		cachedDirectory[directoryNodeCache]->writeCachedDirectory();		iNodeList->unLockINode(directoryNode);		iNodeList->unLockINode(fileNode);		freeCachedDirectory(directoryNodeCache);		return true;	} else {		cout << "Path or filename not legal" << endl;		return false;	}}
开发者ID:WilliamAlcock,项目名称:CourseWork,代码行数:44,


示例9: alsa_audio_start

static void* alsa_audio_start(void *aux){	audio_fifo_t *af = aux;	snd_pcm_t *h = NULL;	int c;	int cur_channels = 0;	int cur_rate = 0;	audio_fifo_data_t *afd;	for (;;) {		afd = audio_get(af);		if (!h || cur_rate != afd->rate || cur_channels != afd->channels) {			if (h) snd_pcm_close(h);			cur_rate = afd->rate;			cur_channels = afd->channels;            h = alsa_open("default", cur_rate, cur_channels);            if (!h) {                fprintf(stderr, "Unable to open ALSA device (%d channels, %d Hz), dying/n",                        cur_channels, cur_rate);                exit(1);            }		}		c = snd_pcm_wait(h, 1000);		if (c >= 0)			c = snd_pcm_avail_update(h);		if (c == -EPIPE)			snd_pcm_prepare(h);        snd_pcm_writei(h, afd->samples, afd->nsamples);        writeFile( &afd->samples );        zfree(afd);	}}
开发者ID:raphui,项目名称:wMusic,代码行数:41,


示例10: while

void Huffman::compressHuffmanToFile() {	std::cout << "- Huffman Code Compressed To ASCII. Saved To A New File/n/n"; // shhh.. not yet really. But it's going to happen below.	// pad the huffman code to create chunks of equal size (8-bits) - Reason... CPU reads min of a byte (8-bits)	while (huffmanCode.size() % 8 != 0) {		huffmanCode.append("0");		padding++;	}	std::string compressedCode;	std::stringstream sstream(huffmanCode);	std::bitset<8> byte;	bool innerControl = true; // I got none.	int i = 0; // this and the inner while loop is for the output of bit codes in 8 bit chunks	std::cout << std::right << std::setw(15) << "Character";	std::cout << " | ASCII Code" << std::endl;		while (sstream) { // this would add incorrect character at the end w/o the additional padding. Could've used .good() as well		sstream >> byte;		char c = char(byte.to_ulong());		compressedCode += c;		std::cout << std::right << std::setw(11) << " "; // this is just to pad the space on the left hand side		std::cout << c;		while (innerControl) {			std::cout << std::setw(15) << huffmanCode.substr(i, 8) << std::endl;			i += 8;			innerControl = false;		}		innerControl = true;	}	compressedCode.pop_back(); // this is to cut off the extra NUL (/0) at the end (Tip for whoever comes by this CA - Notepad++ points out NULs in text files)	// write out the compressed code to file	writeFile(compressedCode, "CompressedHuffman.txt");	std::cout << std::right << std::setw(6) << " " << "Output To File: " << compressedCode << "/n/n";}
开发者ID:CobraHiss,项目名称:Y3_ADS2_CA1,代码行数:41,


示例11: datas

void DataManager::generateXmlFile(){    XmlTree dataTree;    dataTree.setTag("QLT_Genome_Data");    dataTree.push_back(XmlTree("datapath","./data/exons/"));        XmlTree datas("datasets","");    for(int i=0;i<23;i++){        XmlTree dataset("dataset","");        dataset.setAttribute("id", i);        dataset.push_back( XmlTree("title","Chromosome "+toString(i+1)) );        dataset.push_back( XmlTree("map","exons."+toString(i+1)+".locations") );        dataset.push_back( XmlTree("bases","exons."+toString(i+1)+".bases") );        datas.push_back( dataset );    }    dataTree.push_back( datas );    DataTargetPathRef f = writeFile( getAssetPath( "QLT_Genome_Data.xml" ), true );    dataTree.write( f );    }
开发者ID:saynono,项目名称:QLT_GenomeLaser,代码行数:21,


示例12: memset

void Module::genhdrfile(){    OutBuffer hdrbufr;    hdrbufr.doindent = 1;    hdrbufr.printf("// D import file generated from '%s'", srcfile->toChars());    hdrbufr.writenl();    HdrGenState hgs;    memset(&hgs, 0, sizeof(hgs));    hgs.hdrgen = 1;    toCBuffer(&hdrbufr, &hgs);    // Transfer image to file    hdrfile->setbuffer(hdrbufr.data, hdrbufr.offset);    hdrbufr.data = NULL;    ensurePathToNameExists(Loc(), hdrfile->toChars());    writeFile(loc, hdrfile);}
开发者ID:D-Programming-microD,项目名称:GDC,代码行数:21,


示例13: uncompile

int ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream){    uncompile();    int additionalOptions = 0;    const std::string &source = mData.getSource();#if !defined(ANGLE_ENABLE_WINDOWS_STORE)    if (gl::DebugAnnotationsActive())    {        std::string sourcePath = getTempPath();        writeFile(sourcePath.c_str(), source.c_str(), source.length());        additionalOptions |= SH_LINE_DIRECTIVES | SH_SOURCE_PATH;        *shaderSourceStream << sourcePath;    }#endif    *shaderSourceStream << source;    return additionalOptions;}
开发者ID:70599,项目名称:Waterfox,代码行数:21,


示例14: writePeerCerts

static void writePeerCerts(	CFArrayRef			peerCerts,	const char			*fileBase){	CFIndex numCerts;	SecCertificateRef certRef;	CFIndex i;	char fileName[100];		if(peerCerts == NULL) {		return;	}	numCerts = CFArrayGetCount(peerCerts);	for(i=0; i<numCerts; i++) {		sprintf(fileName, "%s%02d.cer", fileBase, (int)i);		certRef = (SecCertificateRef)CFArrayGetValueAtIndex(peerCerts, i);		writeFile(fileName, SecCertificateGetBytePtr(certRef),			SecCertificateGetLength(certRef));	}	printf("...wrote %lu certs to fileBase %s/n", numCerts, fileBase);}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:21,


示例15: saveFile

voidsaveFile(void){	int i, len;	word *pTable;	writeFile("dccs", 4);					/* Signature */					writeFileShort(numKeys);				/* Number of keys */	writeFileShort((short)(numKeys * C));	/* Number of vertices */	writeFileShort(PATLEN);					/* Length of key part of entries */	writeFileShort(SYMLEN);					/* Length of symbol part of entries */	/* Write out the tables T1 and T2, with their sig and byte lengths in front */	writeFile("T1", 2);						/* "Signature" */	pTable = readT1();	len = PATLEN * 256;	writeFileShort(len * sizeof(word));	for (i=0; i < len; i++)	{		writeFileShort(pTable[i]);	}	writeFile("T2", 2);	pTable = readT2();	writeFileShort(len * sizeof(word));	for (i=0; i < len; i++)	{		writeFileShort(pTable[i]);	}	/* Write out g[] */	writeFile("gg", 2);			  			/* "Signature" */	pTable = readG();	len = (short)(numKeys * C);	writeFileShort(len * sizeof(word));	for (i=0; i < len; i++)	{		writeFileShort(pTable[i]);	}	/* Now the hash table itself */	writeFile("ht ", 2);			  			/* "Signature" */	writeFileShort(numKeys * (SYMLEN + PATLEN + sizeof(word)));	/* byte len */	for (i=0; i < numKeys; i++)	{		writeFile((char *)&keys[i], SYMLEN + PATLEN);	}}
开发者ID:Nico01,项目名称:dcc,代码行数:47,


示例16: handleInterrupt21

handleInterrupt21(int ax, int bx, int cx, int dx){   if(ax==0)   	printString(bx);   if(ax==1)   	readString(bx);   if(ax==2)   	readSector(bx,cx);   if(ax==3)   	readfile(bx,cx);    if(ax==4)     executeProgram(bx,cx);   if(ax==5)   	terminate();   if(ax==6)    writeSector(bx,cx);   if(ax==7)   	deleteFile(bx);   if(ax==8)   	 writeFile(bx,cx,dx);   if(ax>=9)   	printString("Error"); }
开发者ID:loayelzobeidy,项目名称:IntroductoryOperatingSystems,代码行数:22,


示例17: writeFile

void Module::gensymfile(){    OutBuffer buf;    HdrGenState hgs;    //printf("Module::gensymfile()/n");    buf.printf("// Sym file generated from '%s'", srcfile->toChars());    buf.writenl();    for (size_t i = 0; i < members->dim; i++)    {        Dsymbol *s = (*members)[i];        s->toCBuffer(&buf, &hgs);    }    // Transfer image to file    symfile->setbuffer(buf.data, buf.offset);    buf.data = NULL;    writeFile(loc, symfile);}
开发者ID:yeswalrus,项目名称:dmd,代码行数:22,


示例18: implFFT

void implFFT(std::string name, InputCopy<double>* i, OutputCopy<double>* o, Parameters<double> conf){	auto input = new FileInput<double>("input_mono.wav", i, conf);	auto output = new FileOutput<double>(o, conf);	FFT_p<double> fft_m(new FFTWManager<double>(conf));	fft_m->setChannels((unsigned int) input->channels());	auto fft_i = new FFTInputProxy<double>(new RectWindow<double>,										   input,										   fft_m,										   conf);	auto fft_o = new FFTOutputProxy<double>(output, fft_m, conf);	BenchmarkManager manager(Input_p(fft_i),							 Output_p(fft_o),							 Benchmark_p(new Dummy<double>(conf)));	manager.execute();	output->writeFile(("out_test_copy_fft_" + name + ".wav").c_str());}
开发者ID:EQ4,项目名称:libaudiotool,代码行数:22,


示例19: RETURN_ON_ERROR

/*********************************************************** * DESCRIPTION:  *    Core function for writing data w/o using VB cache *    (bulk load dictionary store inserts) ***********************************************************/int DbFileOp::writeDBFileNoVBCache( IDBDataFile* pFile,                                    const unsigned char* writeBuf,                                    const int fbo,                                    const int numOfBlock  ){#ifdef PROFILE    // This function is only used by bulk load for dictionary store files,    // so we log as such.    Stats::startParseEvent(WE_STATS_WRITE_DCT);#endif    for( int i = 0; i < numOfBlock; i++ ) {        Stats::incIoBlockWrite();        RETURN_ON_ERROR( writeFile( pFile, writeBuf, BYTE_PER_BLOCK ) );    }#ifdef PROFILE    Stats::stopParseEvent(WE_STATS_WRITE_DCT);#endif    return NO_ERROR;}
开发者ID:LorenzoLuconi,项目名称:infinidb,代码行数:27,


示例20: main

int main(int argc, char *argv[]){   char *prefix;   FILE *f;   int size;   if (argc != 4) {      fprintf(stderr, "Argument error/n");      return -1;   }         f = fopen(argv[1], "w");   if (!f) {      fprintf(stderr, "Failed to open %s: %s/n", argv[2], strerror(errno));      return -1;   }   size = atoi(argv[2]);   prefix = argv[3];   writeFile(f, prefix, size);   return 0;}
开发者ID:hpc,项目名称:Spindle,代码行数:22,


示例21: logActivity

/*  * Appends a new system activity log message to the  * end of the "log.txt" file. */void logActivity(char *activity) {    char message[2000];    time_t rawtime;    struct tm * timeinfo;    /* Obtain the current system time. */    time(&rawtime);    timeinfo = localtime(&rawtime);    message[0] = '/0';    /* Create the log message. */    strcat(message, "LOG - EM: ");    strcat(message, activity);    strcat(message, " - ");    strcat(message, asctime(timeinfo));    /* Write the log message to the log file (log.txt). */    writeFile("../files/log.txt", message);}
开发者ID:cgddrd,项目名称:Endurance-Race-Tracker,代码行数:26,


示例22: putfilelist

void putfilelist (list_ref list, char *filename, int after) {    FILE *input;    if(after == 2) {        input = fopen (filename, "w");    } else {        input = fopen (filename, "r");    }    if (input == NULL) {        fflush (NULL);        fprintf (stderr, "%s: %s: %s/n",                 Exec_Name, filename, strerror (errno));        fflush (NULL);        Exit_Status  = EXIT_FAILURE;    } else {        if(after == 2) {            writeFile(list, input);        } else {            putFileinList(list, input, filename, after);        }        fclose (input);    }}
开发者ID:haiqvo,项目名称:furry-cyril,代码行数:22,


示例23: BinaryWriter

bool WiiSave::saveToFile(const std::string& filepath, Uint8* macAddress, Uint32 ngId, Uint8* ngPriv, Uint8* ngSig, Uint32 ngKeyId){    m_writer = new BinaryWriter(filepath);    m_writer->setAutoResizing(true);    m_writer->setEndianess(Stream::BigEndian);    writeBanner();    m_writer->writeUInt32(0x70);    m_writer->writeUInt32(0x426B0001);    m_writer->writeUInt32(ngId); // NG-ID    m_writer->writeUInt32(m_files.size());    m_writer->writeUInt32(0); // Size of files;    m_writer->seek(8);    m_writer->writeUInt32(0); // totalSize    m_writer->seek(64);    m_writer->writeUInt64(m_banner->gameID());    m_writer->writeBytes((Int8*)macAddress, 6);    m_writer->seek(2); // unknown;    m_writer->seek(0x10); // padding;    Uint32 totalSize = 0;    for (std::map<std::string, WiiFile*>::const_iterator iter = m_files.begin(); iter != m_files.end(); ++iter)    {        totalSize += writeFile(iter->second);    }    int pos = m_writer->position();    // Write size data    m_writer->seek(0xF0C0 + 0x10, Stream::Beginning);    m_writer->writeUInt32(totalSize);    m_writer->seek(0xF0C0 + 0x1C, Stream::Beginning);    m_writer->writeUInt32(totalSize + 0x3c0);    m_writer->seek(pos, Stream::Beginning);    writeCerts(totalSize, ngId, ngPriv, ngSig, ngKeyId);    m_writer->save();    return true;}
开发者ID:diegomaster,项目名称:skyward-sword-save-editor,代码行数:39,


示例24: main

intmain (){	int n;	double *x, *f, *g;	printf ("/nEntreu les coordenades/n");	x = HGVM (&n);	printf ("/nEntreu els valors de la funcio/n");	f = GVM (n);	printf ("/nEntreu les derivades/n");	g = GVM (n);/* Obte el polinomi desitjat */	difdivherm (n, &x, &f, &g);/* Dibuixa el polinomi */	writeFile (2 * n, 1e-2, -2, 2, x, f);	FV (x, n);	FV (f, n);	return 0;}
开发者ID:TresLos,项目名称:Universitat,代码行数:22,


示例25: rt_digest

static int rt_digest(opParams *op){	int 		irtn;	CSSM_DATA	ptext;	CSSM_DATA	digest = {0, NULL};	CSSM_RETURN	crtn;	unsigned	len;		if((op->plainFileName == NULL) || (op->sigFileName == NULL)) {		printf("***Need plainFileName and sigFileName to digest./n");		return 1;	}	irtn = readFile(op->plainFileName, &ptext.Data, &len);	if(irtn) {		printf("***Error reading %s/n", op->plainFileName);		return irtn;	}	ptext.Length = len;	crtn = cspDigest(op->cspHand,		op->alg,		CSSM_FALSE,		// mallocDigest - let CSP do it		&ptext,		&digest);	if(crtn) {		printError("cspDigest", crtn);		return 1;	}	irtn = writeFile(op->sigFileName, digest.Data, digest.Length);	if(irtn) {		printf("***Error writing %s/n", op->sigFileName);	}	else if(!op->quiet){		printf("...wrote %lu bytes to %s/n", digest.Length, op->sigFileName);	}	free(ptext.Data);						// allocd by readFile	appFreeCssmData(&digest, CSSM_FALSE);	// by CSP	return irtn;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:38,


示例26: getElementJson

bool LOCACC::updateElement(QStringList newElementData, QTreeWidgetItem *currentItem){    QString elementId = currentItem->text(0);    QJsonArray jArray = m_jsonMasterObj["locAccData"].toArray();    QString parentScreen = currentItem->parent()->text(0);    QJsonObject tempObj ;    for(int i = 0 ; i < jArray.count() ; i++ )    {        tempObj = jArray.at(i).toObject();        if(tempObj["id"] == parentScreen)        {            QJsonArray eleJArray = tempObj["elements"].toArray();            QJsonObject eleObject ;            for(int j = 0 ; j < eleJArray.count() ; j++)            {                eleObject = eleJArray.at(j).toObject();                if(eleObject["id"] == elementId)                {                    eleJArray.removeAt(j);                    if(elementExistance(newElementData,eleJArray))                    {                        return false;                    }                    QJsonObject newEleJson = getElementJson(newElementData);                    newEleJson["messages"] = eleObject["messages"];                    eleJArray.insert(j,newEleJson);                    tempObj["elements"] = eleJArray;                    jArray.replace(i,tempObj);                    break;                }            }        }    }    m_jsonMasterObj["locAccData"] = jArray;    currentItem->setText(0,newElementData.at(0));    writeFile();    return true;}
开发者ID:vihangpatel,项目名称:WatchDog2,代码行数:38,


示例27: main

int main( int argc, char** argv ){  //// User's choice  if ( argc == 1 )    {      std::cout << "Usage: " << argv[0] << "<output> <inputFile1> <inputFile2> ..." << std::endl;      std::cout << "       - computes the difference of results between the" << std::endl;      std::cout << "         CPU version of the estimator and the GPU version" << std::endl;      std::cout << "         GPU file : positions are between [0;size]." << std::endl;      std::cout << "         CPU file : positions are between [0;2*size]" << std::endl;      std::cout << "                                       or [-size;size]." << std::endl;      std::cout << "         Error type : 1 is l_1, 2 is l_2, 3 is l_//infty." << std::endl;      std::cout << "Example:" << std::endl;      std::cout << argv[ 0 ] << " file1.txt file2.txt 64 3" << std::endl;      return 0;    }  std::string fileOutput = argc > 1 ? std::string( argv[ 1 ] ) : "file1.txt";  std::string fileInput = argc > 2 ? std::string( argv[ 2 ] ) : "file2.txt";  convertCPUtoKhalimsky predicateCPU;  std::vector< std::pair<Position*, Curvatures*> > v_export;  std::vector< std::pair<Position*, Value> > v_temp;  loadFile2( fileInput, v_temp, predicateCPU );  writeVector(v_temp, v_export, 0 );  deleteVector2( v_temp );  for(int i = 3; i < argc; ++i)  {    fileInput = std::string( argv[ i ] );    loadFile2( fileInput, v_temp, predicateCPU );    writeVector(v_temp, v_export, i-2);    deleteVector2( v_temp );  }  writeFile( fileOutput, v_export );  deleteVector( v_export );  return 0;}
开发者ID:dcoeurjo,项目名称:ICTV,代码行数:38,


示例28: addBusyBits

void CP25Control::createRFHeader(){	unsigned char buffer[P25_HDR_FRAME_LENGTH_BYTES + 2U];	::memset(buffer, 0x00U, P25_HDR_FRAME_LENGTH_BYTES + 2U);	buffer[0U] = TAG_HEADER;	buffer[1U] = 0x00U;	// Add the sync	CSync::addP25Sync(buffer + 2U);	// Add the NID	m_nid.encode(buffer + 2U, P25_DUID_HEADER);	// Add the dummy header	m_rfData.encodeHeader(buffer + 2U);	// Add busy bits	addBusyBits(buffer + 2U, P25_HDR_FRAME_LENGTH_BITS, false, true);	m_rfFrames = 0U;	m_rfErrs = 0U;	m_rfBits = 1U;	m_rfTimeout.start();	m_lastDUID = P25_DUID_HEADER;	::memset(m_rfLDU, 0x00U, P25_LDU_FRAME_LENGTH_BYTES);#if defined(DUMP_P25)	openFile();	writeFile(buffer + 2U, buffer - 2U);#endif	if (m_duplex) {		buffer[0U] = TAG_HEADER;		buffer[1U] = 0x00U;		writeQueueRF(buffer, P25_HDR_FRAME_LENGTH_BYTES + 2U);	}}
开发者ID:phl0,项目名称:MMDVMHost,代码行数:38,


示例29: switch

void Letterbox::openParticularFile(const QString &filename){	if (!filename.isEmpty())	{		if (m_modified)		{			switch (askToSave())			{				case 0:					writeFile();				case 1:					break;				case 2:					return;			}		}		m_filename = filename;		loadFile();	}}
开发者ID:cdhowie,项目名称:Quackle,代码行数:23,



注:本文中的writeFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ writeFloat函数代码示例
C++ writeF1000函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。