本文整理汇总了C++中createFile函数的典型用法代码示例。如果您正苦于以下问题:C++ createFile函数的具体用法?C++ createFile怎么用?C++ createFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pipe
void pipe()
{
if (createFile("\\\\.\\pipe\\cuckoo") != INVALID_HANDLE_VALUE)
{
createAndWriteFile("pipe.txt");
printf("Cuckoo Detected (\\\\.\\pipe\\cuckoo)\n");
}
}
示例2: createProject
void ProjectManagerWindow::onCreateClicked()
{
if (!(m_nameLine->text().isEmpty()) && !(m_pathLine->text().isEmpty())) {
QString fileExtension = m_extension[m_listWidget->currentItem()];
if (fileExtension == ".robopro") {
emit createProject(m_nameLine->text(), m_pathLine->text());
emit createFile("main.cpp", m_pathLine->text());
emit projectCreated();
}
else {
emit createFile(m_nameLine->text() + fileExtension, m_pathLine->text());
}
m_nameLine->setText("undefined");
this->close();
}
}
示例3: QString
QString Install::createScriptSetIptablesKernelDefaults()
{
QStringList script;
QString filename = "qiptables-restore-kernel-setting-defaults.sh";
script << "#!/bin/bash"
<< ""
<< GenLib::getGnuLicence().join("\n")
<< ""
<< "################################################"
<< "#"
<< QString("# ").append(filename)
<< "#"
<< "# created by qiptables install program"
<< "#"
<< "#"
<< "################################################"
<< ""
<< ""
<< "echo \"Restoring iptables kernel setting defaults...\""
<< ""
<< "echo \"Enable broadcast echo Protection\" "
<< "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts"
<< ""
<< "echo \"Disable Source Routed Packets\" "
<< "echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route"
<< ""
<< "echo \"Enable TCP SYN Cookie Protection\" "
<< "echo 1 > /proc/sys/net/ipv4/tcp_syncookies"
<< ""
<< "echo \"Disable ICMP Redirect Acceptance\" "
<< "echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects"
<< ""
<< "echo \"Don't send Redirect Messages\" "
<< "echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects"
<< ""
<< "echo \"Drop Spoofed Packets coming in on an interface where responses\" "
<< "echo \"would result in the reply going out a different interface.\" "
<< "echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter"
<< ""
<< " "
<< " ";
// Create the file
filename = createFile(Install::TOOLS_DIR, filename, script, true);
QString tmpSnippetName = "Restore iptables kernel settings defaults";
QStringList snippetList;
snippetList << QString("# %1").arg(tmpSnippetName)
<< filename
<< "";
insertRuleSnippetRow(tmpSnippetName, snippetList);
return filename;
}
示例4: jrnlSync
/*
** Sync the file.
*/
static int jrnlSync(sqlite3_file *pJfd, int flags){
int rc;
JournalFile *p = (JournalFile *)pJfd;
rc = createFile(p);
if( rc==SQLITE_OK ){
rc = sqlite3OsSync(p->pReal, flags);
}
return rc;
}
示例5: fclose
void CFileLog::checkFile()
{
if (nums >= 100000)
{
fclose(fp);
createFile();
nums = 0;
}
}
示例6: createFile
void SHA256TestSuite::someFiles()
{
createFile("empty.txt", "");
CPPUNIT_ASSERT(SHA256::hashFile("empty.txt") ==
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
createFile("superSecretPassword.txt", "passw0rd");
CPPUNIT_ASSERT(SHA256::hashFile("superSecretPassword.txt") ==
"8f0e2f76e22b43e2855189877e7dc1e1e7d98c226c95db247cd1d547928334a9");
createFile("fileWithEmbeddedZeros.txt",
// 1 2
// 12345 678901 234567890 1234
std::string("some\0zeros\0embedded\0here", 24));
CPPUNIT_ASSERT(SHA256::hashFile("fileWithEmbeddedZeros.txt") ==
"ce2755ad80159b7a2ab0adfc0246678239e583f83dbf423b8a48d6c8aedd2cb7");
}
示例7: main
//main ()
int main (int argc, char *argv[]) {
//Call syntax check
if (argc != 3) {
printf ("Usage: %s Title_list_filename Sequence_list_filename\n", argv[0]);
exit (1);
}
//Main variables
string title, sequence;
FILE *titleInFile = NULL, *sequenceInFile = NULL, *outFile = NULL;
int count = 0;
//File creation and checks
printf ("Opening files..\n");
createFile (&titleInFile, argv[1], 'r');
createFile (&sequenceInFile, argv[2], 'r');
createFile (&outFile, "Combined.fasta", 'w');
//Combine entries
printf ("File opened. Combining...\n");
initializeString (&title);
initializeString (&sequence);
while (1) {
//Load the data, break the loop if either list runs out
loadString (&title, titleInFile);
loadString (&sequence, sequenceInFile);
if ((title.str == NULL) || (sequence.str == NULL)) {
break;
}
//Print the new fasta entry and reset for the next set
fprintf (outFile, ">%s\n%s\n", title.str, sequence.str);
reinitializeString (&title);
reinitializeString (&sequence);
//A counter so the user has some idea of how long it will take
if (++count % 1000000 == 0) {
printf ("%d entries combined...\n", count);
}
}
//Close everything and free memory
printf ("%d entries combined. Closing files and freeing memory...\n", count);
free (title.str);
free (sequence.str);
fclose (titleInFile);
fclose (sequenceInFile);
fclose (outFile);
return 0;
}
示例8: createTrackFromUri
int createTrackFromUri( char *uri , char *name )
{
TRACE_2( PLAYERMANAGER , "createTrackFromUri( %s , __track__ )" , uri );
sp_link *link;
sp_error error;
if( playing == FALSE && hasNextTrack() == FALSE )
createFile( name );
TRACE_1( PLAYERMANAGER , "Creating URI : %s" , uri );
link = sp_link_create_from_string( uri );
if( link == NULL )
{
TRACE_ERROR( PLAYERMANAGER , "Fail to create link.");
return PC_ERROR;
}
else
{
TRACE_1( PLAYERMANAGER , "Success to create link.");
}
TRACE_3( PLAYERMANAGER , "Construct track...");
currentTrack = sp_link_as_track( link );
if( currentTrack == NULL )
{
TRACE_ERROR( PLAYERMANAGER , "Fail to create track.");
return PC_ERROR;
}
else
{
TRACE_1( PLAYERMANAGER , "Success to create track.");
}
error = sp_track_add_ref( currentTrack );
if( error != SP_ERROR_OK )
{
TRACE_ERROR( PLAYERMANAGER , "Cannot add ref track, reason: %s" , sp_error_message( error ) );
return PC_ERROR;
}
sp_link_release( link );
running = TRUE;
// playing = FALSE;
return PC_SUCCESS;
}
示例9: Q_UNUSED
void GTest_uHMMERBuild::init(XMLTestFormat* tf, const QDomElement& el) {
Q_UNUSED(tf);
QString inFile = el.attribute(IN_FILE_NAME_ATTR);
if (inFile.isEmpty()) {
failMissingValue(IN_FILE_NAME_ATTR);
return;
}
outFile = el.attribute(OUT_FILE_NAME_ATTR);
if (outFile.isEmpty()) {
failMissingValue(OUT_FILE_NAME_ATTR);
return;
}
QString expOpt = el.attribute(EXP_OPT_ATTR);
if (expOpt.isEmpty()) {
failMissingValue(EXP_OPT_ATTR);
return;
}
QString hmmName = el.attribute(HMM_NAME_ATTR);
QString delTempStr = el.attribute(DEL_TEMP_FILE_ATTR);
if (delTempStr .isEmpty()) {
failMissingValue(DEL_TEMP_FILE_ATTR);
return;
}
if(delTempStr=="yes")
deleteTempFile = true;
else if(delTempStr=="no") deleteTempFile =false;
else {
failMissingValue(DEL_TEMP_FILE_ATTR);
return;
}
UHMMBuildSettings s;
s.name = hmmName;
if(expOpt=="LS") s.strategy = P7_LS_CONFIG;
else if(expOpt=="FS") s.strategy = P7_FS_CONFIG;
else if(expOpt=="BASE") s.strategy = P7_BASE_CONFIG;
else if(expOpt=="SW") s.strategy = P7_SW_CONFIG;
else {
stateInfo.setError( QString("invalid value %1, available values: LS, FS, BASE, SW").arg(EXP_OPT_ATTR) );
return;
}
QFileInfo fi(env->getVar("TEMP_DATA_DIR")+"/"+outFile);
fi.absoluteDir().mkpath(fi.absoluteDir().absolutePath());
QFile createFile(fi.absoluteFilePath());
createFile.open(QIODevice::WriteOnly);
if(!createFile.isOpen()){
stateInfo.setError( QString("File opening error \"%1\", description: ").arg(createFile.fileName())+createFile.errorString() );
return;
}
else createFile.close();
buildTask = new HMMBuildToFileTask(env->getVar("COMMON_DATA_DIR")+"/"+inFile, createFile.fileName(), s);
outFile = createFile.fileName();
addSubTask(buildTask);
}
示例10: createFile
void TraceLog::logNewSectionCalled(const ADDRINT prevAddr, std::string prevSection, std::string currSection)
{
createFile();
m_traceFile
<< std::hex << prevAddr
<< DELIMITER
<< prevSection << "->" << currSection
<< std::endl;
m_traceFile.flush();
}
示例11: TEST_F
TEST_F(FlushRewrittenFilesTest, StoresChangesOnDisk) {
FileID ID = createFile("input.cpp", "line1\nline2\nline3\nline4");
Replacements Replaces;
Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
5, "replaced"));
EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
EXPECT_FALSE(Context.Rewrite.overwriteChangedFiles());
EXPECT_EQ("line1\nreplaced\nline3\nline4",
getFileContentFromDisk("input.cpp"));
}
示例12: order
void TestShellBuddy::testDisableBuddies()
{
/* 3. Deactivate buddy option, Activate open next to active tab
Open a.cpp a.l.txt
Verify order (a.cpp a.l.txt)
Verify that a.l.txt is activated
Activate a.cpp
Open b.cpp
Verify order (a.cpp b.cpp a.l.txt) */
QCOMPARE(m_documentController->openDocuments().count(), 0);
enableBuddies(false);
enableOpenAfterCurrent();
QTemporaryDir dirA;
createFile(dirA, QStringLiteral("a.l.txt"));
createFile(dirA, QStringLiteral("a.r.txt"));
createFile(dirA, QStringLiteral("b.r.txt"));
m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "a.r.txt"));
m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "a.l.txt"));
Sublime::Area *area = m_uiController->activeArea();
Sublime::AreaIndex* areaIndex = area->indexOf(m_uiController->activeSublimeWindow()->activeView());
// Buddies disabled => order of tabs should be the order of file opening
verifyFilename(areaIndex->views().value(0), "a.r.txt");
verifyFilename(areaIndex->views().value(1), "a.l.txt");
verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "a.l.txt");
//activate a.cpp => new doc should be opened right next to it
m_uiController->activeSublimeWindow()->activateView(areaIndex->views().value(0));
m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "b.r.txt"));
verifyFilename(areaIndex->views().value(0), "a.r.txt");
verifyFilename(areaIndex->views().value(1), "b.r.txt");
verifyFilename(areaIndex->views().value(2), "a.l.txt");
verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "b.r.txt");
QCOMPARE(m_documentController->openDocuments().count(), 3);
for(int i = 0; i < 3; i++)
m_documentController->openDocuments().at(0)->close(IDocument::Discard);
QCOMPARE(m_documentController->openDocuments().count(), 0);
}
示例13: createFile
void ViewFileManager::on(QueueManagerListener::ItemAdded, const QueueItemPtr& aQI) noexcept {
if (!isViewedItem(aQI)) {
return;
}
auto file = createFile(aQI->getTarget(), aQI->getTTH(), aQI->isSet(QueueItem::FLAG_TEXT), false);
if (file) {
file->onAddedQueue(aQI->getTarget(), aQI->getSize());
}
}
示例14: p_driver
Generator<Annotation, Runtime, Driver>::Generator(
Driver & driver,
const std::string & file_name
) :
p_driver(driver),
p_file_name(file_name),
p_file_id(createFile())
{
Runtime::useSymbolsKernel(p_driver, p_file_id);
}
示例15: createFile
void LogTraceListener::createFile(const QDateTime& time)
{
if (time.time().hour() == 0 && time.time().minute() == 0)
{
_file->close();
delete _file;
_file = NULL;
createFile(_logPath.c_str());
}
}