• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ outputFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assert

// static
bool PortablePixelMapIO::writeRGB( QString filename,								  
								  ubyte* aubRGBArray,
								  int width, int height,								  
								  bool yAxisPointsUp )
{
	assert( aubRGBArray != NULL );

	QFile outputFile( filename );

	// try to open the file in write only mode
	if( !( outputFile.open( QIODevice::WriteOnly ) ) )
	{
		return false;
	}

	QTextStream outputTextStream( &outputFile );
	outputTextStream.setCodec( "ISO-8859-1" );
	outputTextStream << "P6\n";
	outputTextStream << width << " " << height << "\n";
	outputTextStream << "255\n";

	outputTextStream.flush();

	QDataStream outputDataStream( &outputFile );	

	if( yAxisPointsUp )
	{
		for( int y = 0; y < height; ++y )
		{
			for( int x = 0; x < width; ++x )
			{
				int yy = height - y - 1;

				int k = 3 * ( yy * width + x );

				outputDataStream << aubRGBArray[ k ];
				outputDataStream << aubRGBArray[ k + 1 ];
				outputDataStream << aubRGBArray[ k + 2 ];
			}
		}
	}
	else
	{
		for( int y = 0; y < height; ++y )
		{
			for( int x = 0; x < width; ++x )
			{
				int k = 3 * ( y * width + x );

				outputDataStream << aubRGBArray[ k ];
				outputDataStream << aubRGBArray[ k + 1 ];
				outputDataStream << aubRGBArray[ k + 2 ];
			}
		}
	}	

	return true;
}
开发者ID:FreeAlex,项目名称:Halide,代码行数:59,代码来源:PortablePixelMapIO.cpp


示例2: outFilename

void HHRImpl::write2Json() {

	string outFilename(outputFileLocation);
	outFilename += rootName;
	outFilename += "/HHR/";
	outFilename += "hhr.json";
	//cout << outFilename << endl;
	ofstream outputFile(outFilename.c_str());

	outputFile << "{" << "\n";
	for (int i = 0; i < hhrResultVector.size(); i++) {
		outputFile << "\"protein" << i << "\":{\n";
		outputFile << "\t\"proteinName\":\""
				<< hhrResultVector[i].getProteinName() << "\",\n";
		outputFile << "\t\"probab\":\"" << hhrResultVector[i].getProbab()
				<< "\",\n";
		outputFile << "\t\"OriginalSequenceLength\":\"" << proteinSeqLength
				<< "\",\n";

		outputFile << "\t\"eValue\":\"" << hhrResultVector[i].getExpect()
				<< "\",\n";
		outputFile << "\t\"score\":\"" << hhrResultVector[i].getScore()
				<< "\",\n";
		outputFile << "\t\"alignedCols\":\""
				<< hhrResultVector[i].getAlignedCols() << "\",\n";
		outputFile << "\t\"identities\":\""
				<< hhrResultVector[i].getIdentities() << "\",\n";

		outputFile << "\t\"QueryStart\":\""
				<< hhrResultVector[i].getQueryStart() << "\",\n";
		outputFile << "\t\"Query\":\"" << hhrResultVector[i].getQuery()
				<< "\",\n";
		outputFile << "\t\"QueryEnd\":\"" << hhrResultVector[i].getQueryEnd()
				<< "\",\n";
		outputFile << "\t\"QueryConsensus\":\""
				<< hhrResultVector[i].getQueryConsensus() << "\",\n";
		outputFile << "\t\"alignment\":\"" << hhrResultVector[i].getAlignment()
				<< "\",\n";
		outputFile << "\t\"TargetStart\":\""
				<< hhrResultVector[i].getTargetStart() << "\",\n";
		outputFile << "\t\"TargetConsensus\":\""
				<< hhrResultVector[i].getTargetConsensus() << "\",\n";
		outputFile << "\t\"TargetEnd\":\"" << hhrResultVector[i].getTargetEnd()
				<< "\",\n";
		outputFile << "\t\"target\":\"" << hhrResultVector[i].getTarget()
				<< "\",\n";
		outputFile << "\t\"targetConf\":\""
				<< hhrResultVector[i].getConfidence() << "\",\n";
		outputFile << "\t\"tPred\":\"" << hhrResultVector[i].getTargetSsPred()
				<< "\"\n";
		outputFile << "},\n";
	}
	outputFile << "\"finish\":\"end\"" << "\n";
	outputFile << "}" << "\n";

	outputFile.close();

}
开发者ID:rafaelfang,项目名称:Utility,代码行数:58,代码来源:HHRImpl.cpp


示例3: outputFile

void HelpWriterContext::writeOptionItem(const std::string &name,
                                        const std::string &value,
                                        const std::string &defaultValue,
                                        const std::string &info,
                                        const std::string &description) const
{
    TextWriter &file = outputFile();
    switch (outputFormat())
    {
        case eHelpOutputFormat_Console:
        {
            TextTableFormatter &formatter(impl_->state_->consoleOptionsFormatter());
            formatter.clear();
            formatter.addColumnLine(0, name);
            formatter.addColumnLine(1, value);
            if (!defaultValue.empty())
            {
                formatter.addColumnLine(2, "(" + defaultValue + ")");
            }
            if (!info.empty())
            {
                formatter.addColumnLine(3, "(" + info + ")");
            }
            TextLineWrapperSettings settings;
            settings.setIndent(11);
            settings.setLineLength(78);
            std::string formattedDescription
                = substituteMarkupAndWrapToString(settings, description);
            file.writeLine(formatter.formatRow());
            file.writeLine(formattedDescription);
            break;
        }
        case eHelpOutputFormat_Rst:
        {
            std::string args(value);
            if (!defaultValue.empty())
            {
                args.append(" (");
                args.append(defaultValue);
                args.append(")");
            }
            if (!info.empty())
            {
                args.append(" (");
                args.append(info);
                args.append(")");
            }
            file.writeLine(formatString("``%s`` %s", name.c_str(), args.c_str()));
            TextLineWrapperSettings settings;
            settings.setIndent(4);
            file.writeLine(substituteMarkupAndWrapToString(settings, description));
            break;
        }
        default:
            GMX_THROW(NotImplementedError(
                              "This output format is not implemented"));
    }
}
开发者ID:MrTheodor,项目名称:gromacs,代码行数:58,代码来源:helpwritercontext.cpp


示例4: outputFile

void ResponseCurve::writeToFile(const std::string& fileName) const
{
    ScopedStdIoFile outputFile(fopen(fileName.c_str(), "w"));
    responseSave(outputFile.data(),
                 m_responses[RESPONSE_CHANNEL_RED].data(),
                 m_responses[RESPONSE_CHANNEL_GREEN].data(),
                 m_responses[RESPONSE_CHANNEL_BLUE].data(),
                 NUM_BINS);
}
开发者ID:DINKIN,项目名称:LuminanceHDR,代码行数:9,代码来源:responses.cpp


示例5: outputFile

bool QgsMeshCalculatorDialog::filePathValid() const
{
  QString outputPath = outputFile();
  if ( outputPath.isEmpty() )
    return false;

  outputPath = QFileInfo( outputPath ).absolutePath();
  return QFileInfo( outputPath ).isWritable();
}
开发者ID:dwsilk,项目名称:QGIS,代码行数:9,代码来源:qgsmeshcalculatordialog.cpp


示例6: main

int main()
{
	std::ifstream inputFile(SOURCE_DIR "/input.txt");
	std::ofstream outputFile(SOURCE_DIR "/output.txt" );
	
	if ( inputFile && outputFile)
	{
		int countKey = 0;
		std::string countKeyString;
		std::vector < long long > keys; 

		std::getline(inputFile, countKeyString);
		countKey = atoi(countKeyString.c_str());
		
		for (int i = 0; i < countKey; ++i)
		{
			std::string key;
			if (!inputFile.eof())
			{
				std::getline(inputFile, key);
				keys.push_back((long long)(atof(key.c_str()) * accuracy));
			} else 
			{
				break;
			}
		}
		
		while (!inputFile.eof()) 
		{
			std::string passwordString;
			std::getline(inputFile, passwordString);
			
			if (passwordString.empty())
				continue;

			long long password = (long long)(atof(passwordString.c_str()) * accuracy);
			
			for (int i = 0; i < countKey; ++i)
			{
				if (password == keys[i])
				{
					outputFile << std::string("YES") << std::endl;
					break;
				} else
				{
					if (i + 1 == countKey)
						outputFile << std::string("NO") << std::endl;
					continue;
				}
			}
		}

		inputFile.close();
		outputFile.close();
	}
	return 0;
}
开发者ID:Aljaksandr,项目名称:cpp_craft_1013,代码行数:57,代码来源:main.cpp


示例7: outFilename

void BLAPDBImpl::write2Json() {

	string outFilename(outputFileLocation);
	outFilename += rootName;
	outFilename += "/BLAPDB/";
	outFilename += "blaPDB.json";
	//cout<<outFilename<<endl;
	ofstream outputFile(outFilename.c_str());

	outputFile << "{" << "\n";

	for (int i = 0; i < blaPDBResultVector.size(); i++) {

		outputFile << "\"protein" << i << "\":{\n";
		outputFile << "\t\"proteinName\":\""
				<< blaPDBResultVector[i].getProteinName() << "\",\n";
		outputFile << "\t\"OriginalSequenceLength\":\"" << proteinSeqLength
				<< "\",\n";
		outputFile << "\t\"Length\":\"" << blaPDBResultVector[i].getLength()
				<< "\",\n";
		outputFile << "\t\"Score\":\"" << blaPDBResultVector[i].getScore()
				<< "\",\n";
		outputFile << "\t\"Expect\":\"" << blaPDBResultVector[i].getExpect()
				<< "\",\n";
		outputFile << "\t\"Identities\":\""
				<< blaPDBResultVector[i].getIdentities() << "%\",\n";
		outputFile << "\t\"Positives\":\""
				<< blaPDBResultVector[i].getPositives() << "%\",\n";
		outputFile << "\t\"Gaps\":\"" << blaPDBResultVector[i].getGaps()
				<< "%\",\n";
		outputFile << "\t\"CoveragePercentage\":\""
				<< double((blaPDBResultVector[i].getSubjectEnd()
						- blaPDBResultVector[i].getSubjectStart() + 1
						- blaPDBResultVector[i].getGapNum()))
						/ (proteinSeqLength) << "%\",\n";
		outputFile << "\t\"QueyStart\":\""
				<< blaPDBResultVector[i].getQueryStart() << "\",\n";
		outputFile << "\t\"Query\":\"" << blaPDBResultVector[i].getQuery()
				<< "\",\n";
		outputFile << "\t\"QueryEnd\":\"" << blaPDBResultVector[i].getQueryEnd()
				<< "\",\n";
		outputFile << "\t\"Alignment\":\""
				<< blaPDBResultVector[i].getAlignment() << "\",\n";
		outputFile << "\t\"SubjectStart\":\""
				<< blaPDBResultVector[i].getSubjectStart() << "\",\n";
		outputFile << "\t\"Subject\":\"" << blaPDBResultVector[i].getSubject()
				<< "\",\n";
		outputFile << "\t\"SubjectEnd\":\""
				<< blaPDBResultVector[i].getSubjectEnd() << "\"\n";
		outputFile << "},\n";
	}
	outputFile << "\"finish\":\"end\"" << "\n";
	outputFile << "}" << "\n";

	outputFile.close();

}
开发者ID:rafaelfang,项目名称:Utility,代码行数:57,代码来源:BLAPDBImpl.cpp


示例8: outputFile

void HelpWriterContext::writeTextBlock(const std::string &text) const
{
    TextLineWrapperSettings settings;
    if (outputFormat() == eHelpOutputFormat_Console)
    {
        settings.setLineLength(78);
    }
    outputFile().writeLine(substituteMarkupAndWrapToString(settings, text));
}
开发者ID:daniellandau,项目名称:gromacs,代码行数:9,代码来源:helpwritercontext.cpp


示例9: outputFile

void CLMBlockModel::saveStates(const std::string strTSVFilename) const
{
	std::ofstream outputFile(strTSVFilename.c_str());
	for(int i=0; i<(int)aAllSubcatchments.size(); i++)
	{
		if(!getSubcatchment(i)->getDownstreamCatchment())
			getSubcatchment(i)->saveStates(outputFile);
	}
}
开发者ID:JustineSurGithub,项目名称:tom-cv,代码行数:9,代码来源:lm_block_model.cpp


示例10: Q_UNUSED

bool LibSingleFileInterface::copyFiles(const QList<QVariant> & files, const QString & destinationDirectory, Kerfuffle::ExtractionOptions options)
{
    Q_UNUSED(files)
    Q_UNUSED(options)

    QString outputFileName = destinationDirectory;
    if (!destinationDirectory.endsWith(QLatin1Char('/'))) {
        outputFileName += QLatin1Char('/');
    }
    outputFileName += uncompressedFileName();

    outputFileName = overwriteFileName(outputFileName);
    if (outputFileName.isEmpty()) {
        return true;
    }

    kDebug() << "Extracting to" << outputFileName;

    QFile outputFile(outputFileName);
    if (!outputFile.open(QIODevice::WriteOnly)) {
        kDebug() << "Failed to open output file" << outputFile.errorString();
        emit error(i18nc("@info", "Ark could not extract <filename>%1</filename>.", outputFile.fileName()));

        return false;
    }

    QIODevice *device = KFilterDev::deviceForFile(filename(), m_mimeType, false);
    if (!device) {
        kDebug() << "Could not create KFilterDev";
        emit error(i18nc("@info", "Ark could not open <filename>%1</filename> for extraction.", filename()));

        return false;
    }

    device->open(QIODevice::ReadOnly);

    qint64 bytesRead;
    QByteArray dataChunk(1024*16, '\0');   // 16Kb

    while (true) {
        bytesRead = device->read(dataChunk.data(), dataChunk.size());

        if (bytesRead == -1) {
            emit error(i18nc("@info", "There was an error while reading <filename>%1</filename> during extraction.", filename()));
            break;
        } else if (bytesRead == 0) {
            break;
        }

        outputFile.write(dataChunk.data(), bytesRead);
    }

    delete device;

    return true;
}
开发者ID:pombreda,项目名称:git-anongit.kde.org-ark,代码行数:56,代码来源:singlefileplugin.cpp


示例11: saveJson

bool saveJson(const QString &filename, const QJsonDocument &document) {
    bool success = false;
    QFile outputFile(filename);

    if (outputFile.open(QIODevice::WriteOnly)) {
        outputFile.write(document.toJson(QJsonDocument::Indented));
        success = true;
    }

    return success;
}
开发者ID:Ribtoks,项目名称:heap,代码行数:11,代码来源:main.cpp


示例12: outputFile

void MainWindow::saveDirectory(const QString &dir)
{
    QFile outputFile(LAST_FILE);
    outputFile.open(QIODevice::WriteOnly);

    if(outputFile.isOpen()){
        QTextStream outStream(&outputFile);
        outStream << dir;
        outputFile.close();
    }
}
开发者ID:DavidMCerdeira,项目名称:EL-Configuration-Interface,代码行数:11,代码来源:mainwindow.cpp


示例13: WPXFileStream

KoFilter::ConversionStatus WPGImport::convert(const QByteArray& from, const QByteArray& to)
{
    if (from != "application/x-wpg")
        return KoFilter::NotImplemented;

    if (to != "image/svg+xml")
        return KoFilter::NotImplemented;

#if LIBWPG_VERSION_MINOR<2
    WPXInputStream* input = new libwpg::WPGFileStream(m_chain->inputFile().toLocal8Bit());
    if (input->isOLEStream()) {
        WPXInputStream* olestream = input->getDocumentOLEStream();
        if (olestream) {
            delete input;
            input = olestream;
        }
    }
    libwpg::WPGString output;
#else
    WPXInputStream* input = new WPXFileStream(m_chain->inputFile().toLocal8Bit());
    if (input->isOLEStream()) {
        WPXInputStream* olestream = input->getDocumentOLEStream("Anything");
        if (olestream) {
            delete input;
            input = olestream;
        }
     }
     ::WPXString output;
#endif

    if (!libwpg::WPGraphics::isSupported(input)) {
        kWarning() << "ERROR: Unsupported file format (unsupported version) or file is encrypted!";
        delete input;
        return KoFilter::NotImplemented;
    }

    if (!libwpg::WPGraphics::generateSVG(input, output)) {
        kWarning() << "ERROR: SVG Generation failed!";
        delete input;
        return KoFilter::ParsingError;
    }

    delete input;

    QFile outputFile(m_chain->outputFile());
    if(!outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
        kWarning() << "ERROR: Could not open output file" << m_chain->outputFile();
        return KoFilter::InternalError;
    }
    outputFile.write(output.cstr());
    outputFile.close();

    return KoFilter::OK;
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:54,代码来源:WPGImport.cpp


示例14: outputFile

bool ExportManager::localSave(const QUrl &url, const QString &mimetype)
{
    QFile outputFile(url.toLocalFile());

    outputFile.open(QFile::WriteOnly);
    if(!writeImage(&outputFile, mimetype.toLatin1())) {
        emit errorMessage(i18n("Cannot save screenshot. Error while writing file."));
        return false;
    }
    return true;
}
开发者ID:KDE,项目名称:spectacle,代码行数:11,代码来源:ExportManager.cpp


示例15: main

int main(int argc, char* argv[])
{
	//loadCalculatedValues();
	parseFile("input.txt");
	initMatrix();
	calculateCurrentMoves();
	runTestMoves();
	outputFile("output.txt");
	//std::cout << "p1 score is " << player1Score << " p2 score is " << player2Score << std::endl;
	return 0;
}
开发者ID:jkcn90,项目名称:HPS2013,代码行数:11,代码来源:Voronoi.cpp


示例16: tr

void QgsRasterTerrainAnalysisDialog::on_mExportToCsvButton_clicked()
{
  QString file = QFileDialog::getSaveFileName( 0, tr( "Export Frequency distribution as csv" ), QDir::homePath() );
  if ( file.isEmpty() )
  {
    return;
  }

  QgsRelief relief( inputFile(), outputFile(), outputFormat() );
  relief.exportFrequencyDistributionToCsv( file );
}
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:11,代码来源:qgsrasterterrainanalysisdialog.cpp


示例17: SerializeToFileJustChunk

 static void SerializeToFileJustChunk(
     ColladaConversion::NascentChunkArray chunks,
     const char destinationFilename[],
     const ConsoleRig::LibVersionDesc& versionInfo)
 {
     BasicFile outputFile(destinationFilename, "wb");
     for (unsigned i=0; i<(unsigned)chunks->size(); ++i) {
         auto& c = (*chunks)[i];
         outputFile.Write(AsPointer(c._data.begin()), c._data.size(), 1);
     }
 }
开发者ID:Clever-Boy,项目名称:XLE,代码行数:11,代码来源:ColladaCompilerInterface.cpp


示例18: generateSentimenFile

std::string generateSentimenFile(std::string sentimentFile, int cutOff, string benchmarkNr){
    
    std::string outputFile("sentiments/" + benchmarkNr + "-" + to_string(cutOff) + "-" + sentimentFile);
    
    if(!fileExists(outputFile)){
        std::cout << "Parts for "<< outputFile << std::endl;
        std::string command(shufPath + " -o " + outputFile + " -n $( expr $( sed -n '$=' " + sentimentFile + " ) / 4 \\* " + to_string(cutOff) + " ) " + sentimentFile);
        //cout << command << endl;
        system(command.c_str());
    }
    return outputFile;
}
开发者ID:schuay,项目名称:advanced_internet_computing,代码行数:12,代码来源:main.cpp


示例19: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	CppUnit::TextUi::TestRunner runner;

#ifdef _DEBUG
	std::ofstream outputFile("..\\output\\debug\\UnitTest_Results.xml");
#else
	std::ofstream outputFile("..\\output\\release\\UnitTest_Results.xml");
#endif

	CppUnit::Outputter *myoutputter;
	myoutputter = new CppUnit::XmlOutputter(&runner.result(), outputFile, "UTF-8");
	runner.setOutputter(myoutputter);

	CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry("UCUnitTest");
	runner.addTest( registry.makeTest() );

	runner.run();

	return 0;
}
开发者ID:eSDK,项目名称:eSDKClient_Soultion,代码行数:21,代码来源:UCUnitTest.cpp


示例20: outputFile

bool QgsRasterFileWriter::writeVRT( const QString& file )
{
  QFile outputFile( file );
  if ( ! outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
  {
    return false;
  }

  QTextStream outStream( &outputFile );
  mVRTDocument.save( outStream, 2 );
  return true;
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:12,代码来源:qgsrasterfilewriter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ outputString函数代码示例发布时间:2022-05-30
下一篇:
C++ outputError函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap