本文整理汇总了C++中createFile函数的典型用法代码示例。如果您正苦于以下问题:C++ createFile函数的具体用法?C++ createFile怎么用?C++ createFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pipe
void pipe()
{
if (createFile("\\\\.\\pipe\\cuckoo") != INVALID_HANDLE_VALUE)
{
createAndWriteFile("pipe.txt");
printf("Cuckoo Detected (\\\\.\\pipe\\cuckoo)\n");
}
}
开发者ID:AlicanAkyol,项目名称:sems,代码行数:8,代码来源:CuckooDetect.cpp
示例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();
}
}
开发者ID:gitter-badger,项目名称:mur-ide,代码行数:17,代码来源:projectmanagerwindow.cpp
示例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;
}
开发者ID:tailored,项目名称:qiptables,代码行数:58,代码来源:install.cpp
示例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;
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:12,代码来源:journal.c
示例5: fclose
void CFileLog::checkFile()
{
if (nums >= 100000)
{
fclose(fp);
createFile();
nums = 0;
}
}
开发者ID:haoustc,项目名称:dial,代码行数:9,代码来源:CFileLog.cpp
示例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");
}
开发者ID:Andersbakken,项目名称:rct,代码行数:18,代码来源:SHA256TestSuite.cpp
示例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;
}
开发者ID:SethM55,项目名称:BCB-programs,代码行数:45,代码来源:Fasta_file_combiner.c
示例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;
}
开发者ID:raphui,项目名称:wMusic,代码行数:56,代码来源:player.c
示例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);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:56,代码来源:uhmmerTests.cpp
示例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();
}
开发者ID:ExpLife0011,项目名称:tiny_tracer,代码行数:10,代码来源:TraceLog.cpp
示例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"));
}
开发者ID:gwelymernans,项目名称:lfort,代码行数:10,代码来源:RefactoringTest.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);
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:43,代码来源:test_shellbuddy.cpp
示例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());
}
}
开发者ID:Nordanvind,项目名称:airgit,代码行数:10,代码来源:ViewFileManager.cpp
示例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);
}
开发者ID:imace,项目名称:rose-1,代码行数:10,代码来源:generator.hpp
示例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());
}
}
开发者ID:davidbao,项目名称:SmartTimer,代码行数:10,代码来源:LogTraceListener.cpp
示例16: tsk_fs_dir_open
/*
* Class: edu_uw_apl_commons_tsk4j_filesys_FileSystem
* Method: dirOpen
* Signature: (JLjava/lang/String;)Ledu/uw/apl/commons/tsk4j/filesys/Directory;
*/
JNIEXPORT jobject JNICALL
Java_edu_uw_apl_commons_tsk4j_filesys_FileSystem_dirOpen
(JNIEnv *env, jobject thiz, jlong nativePtr, jstring path ) {
const char* pathC = (*env)->GetStringUTFChars( env, path, NULL );
TSK_FS_INFO* info = (TSK_FS_INFO*)nativePtr;
TSK_FS_DIR* fsDir = tsk_fs_dir_open( info, pathC );
if( !fsDir ) {
(*env)->ReleaseStringUTFChars( env, path, pathC );
return (jobject)NULL;
}
TSK_FS_FILE* fsFile = fsDir->fs_file;
jobject fileMeta = NULL;
if( fsFile->meta ) {
fileMeta = createFileMeta( env, fsFile->meta );
if( !fileMeta ) {
tsk_fs_dir_close( fsDir );
(*env)->ReleaseStringUTFChars( env, path, pathC );
return NULL;
}
}
jobject fileName = NULL;
if( fsFile->name ) {
fileName = createFileName( env, fsFile->name );
if( !fileName ) {
tsk_fs_dir_close( fsDir );
(*env)->ReleaseStringUTFChars( env, path, pathC );
// LOOK: release fileMeta ????
return NULL;
}
}
jobject file = createFile( env, fsFile, thiz, fileMeta, fileName );
if( !file ) {
tsk_fs_dir_close( fsDir );
(*env)->ReleaseStringUTFChars( env, path, pathC );
// LOOK: release fileMeta, fileName ????
return NULL;
}
jobject result = createDirectory( env, fsDir, thiz, file );
if( !result ) {
tsk_fs_dir_close( fsDir );
(*env)->ReleaseStringUTFChars( env, path, pathC );
// LOOK: release fileMeta, fileName, file ????
return NULL;
}
(*env)->ReleaseStringUTFChars( env, path, pathC );
return result;
}
开发者ID:uw-dims,项目名称:tsk4j,代码行数:60,代码来源:filesystem.c
示例17: main
int main(int argc, char *argv[])
{
if ( argc != 2 )
{
/* display usage on error stream */
fprintf(stderr, "usage: znm-project project_name\n\n");
exit(1); /* exit status of the program : non-zero for errors */
}
if ( QString("--help") == argv[1] )
{
printf ("usage: znm-project project_name\nCreates a zenom project.\n\n");
exit(0); /* exit status of the program : non-zero for errors */
}
QDir projectDir;
if ( projectDir.exists( argv[1] ) )
{
fprintf(stderr, "The project cannot be created because '%s' folder already exists.\n", argv[1]);
exit(1); /* exit status of the program : non-zero for errors */
}
projectDir.mkpath( argv[1] );
projectDir.cd( argv[1] );
QFileInfo programFileInfo( getexepath() );
QString projectName( QFileInfo(argv[1]).fileName() );
createFile( programFileInfo.dir().filePath("znm-project-main.template"), projectDir.filePath("main.cpp"), projectName );
createFile( programFileInfo.dir().filePath("znm-project-makefile.template"), projectDir.filePath("Makefile"), projectName );
// Open project file to write
QFile configFile( projectDir.filePath(QString("%1.znm").arg(projectName)) );
if ( !configFile.open(QFile::WriteOnly | QFile::Text) )
{
fprintf(stderr, "The project cannot be created because the file '%s' could not be opened.\n", configFile.fileName().toAscii().data());
exit(1); /* exit status of the program : non-zero for errors */
}
configFile.close();
return 0;
}
开发者ID:emreaslan,项目名称:zenom,代码行数:42,代码来源:main.cpp
示例18: initSysop
void initSysop(void) {
long tid;
createDirOrDie("NiKom:Users");
createDirOrDie("NiKom:Users/0");
createDirOrDie("NiKom:Users/0/0");
time(&tid);
userData.forst_in=tid;
userData.senast_in=tid;
createFile("NiKom:Users/0/0/Data", &userData, sizeof(struct User));
unreadTexts.bitmapStartText = 0;
memset(unreadTexts.bitmap, 0xff, UNREADTEXTS_BITMAPSIZE/8);
memset(unreadTexts.lowestPossibleUnreadText, 0, MAXMOTE * sizeof(long));
createFile("NiKom:Users/0/0/UnreadTexts", &unreadTexts, sizeof(struct UnreadTexts));
createFile("Nikom:Users/0/0/.firstletter", "0", 1);
createFile("Nikom:Users/0/0/.nextletter", "0", 1);
}
开发者ID:punktniklas,项目名称:NiKom,代码行数:20,代码来源:InitNiKom.c
示例19: test_createCloseUnlink
void test_createCloseUnlink(){
char* filename = "AAUnlinkZ.txt";
int fdCreate = createFile(filename);
close(fdCreate);
int unlinkSuccess = unlink(filename);
if (unlinkSuccess == 0){
printf("-------test_createCloseUnlink TEST PASSED-------\n");
} else {
printf("-------test_createCloseUnlink TEST FAILED-------\n");
}
}
开发者ID:derrickallenlo,项目名称:eecs211_nachos,代码行数:11,代码来源:miscTestCases.c
示例20: main
//main ()
int main (int argc, char *argv[]) {
//Call syntax check
if (argc != 6) {
printf ("Usage: %s Fasta_filename Human_interactions Yeast_interactions Negative_interactions Output_CSV_filename\n", argv[0]);
exit (1);
}
//Main variables
fastaEntry *firFasta = NULL;
FILE *inFile, *fasFile, *outFile;
//File creation and checks
printf ("Opening initial files...\n");
createFile (&fasFile, argv[1], 'r');
createFile (&inFile, argv[2], 'r');
createFile (&outFile, argv[5], 'w');
fprintf (outFile, "Source,Protein,A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,Class\n");
//Build dynamic linked list of scaf data
printf ("Files found and created. Compiling fasta entries...\n");
createFastaEntry (&firFasta);
createFastaList (firFasta, fasFile);
fclose (fasFile);
//Find the entries from the Human interaction file
printf ("Compiled. Cross referencing with Human interaction profile...\n");
crossCheck (firFasta, 'H', 'I', inFile, outFile);
fclose (inFile);
//Find the entries from the Yeast interaction file
printf ("Cross referenced. Cross referencing with Yeast interaction profile...\n");
createFile (&inFile, argv[3], 'r');
crossCheck (firFasta, 'Y', 'I', inFile, outFile);
fclose (inFile);
//Find the entries from the Negative interaction file
printf ("Cross referenced. Cross referencing with Negative interaction profile...\n");
createFile (&inFile, argv[4], 'r');
crossCheck (firFasta, 'N', 'N', inFile, outFile);
fclose (inFile);
//Close everything
printf ("Cross referenced. Freeing memory and closing files...\n");
fclose (outFile);
freeFastaList (firFasta);
printf ("Done.\n");
return 0;
}
开发者ID:SethM55,项目名称:BCB-programs,代码行数:42,代码来源:PPI_AA_frequency_compiler.c
注:本文中的createFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论