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

C++ checkFile函数代码示例

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

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



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

示例1: _extract_dependency

/* Decide if the dependency identified by item is in a onedir or onfile archive
 * then call the appropriate function.
 */
static int _extract_dependency(ARCHIVE_STATUS *archive_pool[], const char *item)
{
    ARCHIVE_STATUS *status = NULL;
    ARCHIVE_STATUS *archive_status = archive_pool[0];
    char path[PATH_MAX];
    char filename[PATH_MAX];
    char srcpath[PATH_MAX];
    char archive_path[PATH_MAX];

    char dirname[PATH_MAX];

    VS("LOADER: Extracting dependencies\n");
    if (splitName(path, filename, item) == -1)
        return -1;

    pyi_path_dirname(dirname, path);

    /* We need to identify three situations: 1) dependecies are in a onedir archive
     * next to the current onefile archive, 2) dependencies are in a onedir/onefile
     * archive next to the current onedir archive, 3) dependencies are in a onefile
     * archive next to the current onefile archive.
     */
    VS("LOADER: Checking if file exists\n");
    // TODO implement pyi_path_join to accept variable length of arguments for this case.
    if (checkFile(srcpath, "%s%s%s%s%s", archive_status->homepath, PYI_SEPSTR, dirname, PYI_SEPSTR, filename) == 0) {
        VS("LOADER: File %s found, assuming is onedir\n", srcpath);
        if (copyDependencyFromDir(archive_status, srcpath, filename) == -1) {
            FATALERROR("Error coping %s\n", filename);
            return -1;
        }
    // TODO implement pyi_path_join to accept variable length of arguments for this case.
    } else if (checkFile(srcpath, "%s%s%s%s%s%s%s", archive_status->homepath, PYI_SEPSTR, "..", PYI_SEPSTR, dirname, PYI_SEPSTR, filename) == 0) {
        VS("LOADER: File %s found, assuming is onedir\n", srcpath);
        if (copyDependencyFromDir(archive_status, srcpath, filename) == -1) {
            FATALERROR("Error coping %s\n", filename);
            return -1;
        }
    } else {
        VS("LOADER: File %s not found, assuming is onefile.\n", srcpath);
        // TODO implement pyi_path_join to accept variable length of arguments for this case.
        if ((checkFile(archive_path, "%s%s%s.pkg", archive_status->homepath, PYI_SEPSTR, path) != 0) &&
            (checkFile(archive_path, "%s%s%s.exe", archive_status->homepath, PYI_SEPSTR, path) != 0) &&
            (checkFile(archive_path, "%s%s%s", archive_status->homepath, PYI_SEPSTR, path) != 0)) {
            FATALERROR("Archive not found: %s\n", archive_path);
            return -1;
        }

        if ((status = _get_archive(archive_pool, archive_path)) == NULL) {
            FATALERROR("Archive not found: %s\n", archive_path);
            return -1;
        }
        if (extractDependencyFromArchive(status, filename) == -1) {
            FATALERROR("Error extracting %s\n", filename);
            free(status);
            return -1;
        }
    }

    return 0;
}
开发者ID:madprog,项目名称:pyinstaller-allinone-pyd,代码行数:63,代码来源:pyi_launch.c


示例2: checkFile

bool OutputPage::validatePage()
{
    return checkFile(m_ui.projectLineEdit->text(),
        tr("Qt Help Project File"))
        && checkFile(m_ui.collectionLineEdit->text(),
        tr("Qt Help Collection Project File"));
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:7,代码来源:outputpage.cpp


示例3: main

int main()
{
    std::string txtPath  = "../data/test.txt";
    std::string symPath  = "../data/SoftLink.txt";
    std::string hardPath = "../data/HardLink.txt";

    checkFile(txtPath);
    checkFile(symPath);
    checkFile(hardPath);

    return 0;
}
开发者ID:monsdar,项目名称:BoostSymLinkError,代码行数:12,代码来源:main.cpp


示例4: main

int main(int argc, char **argv){
	if(argc > 3)
		return 0;
	//Non-verbose mode
	else if(argc == 2){
		input1 = fopen(argv[1], "r");

		if(input1 == NULL)
			return 0;

		//printf("This obj file\n");
		if (checkFile() == FALSE){
			fprintf(stderr,"Wrong format\n");
			return 0;
		}
		//printf("Correct format\n");
		rewind(input1);

		_non_verbose = TRUE;
		
		process();
		fclose(input1);
	}
	//Verbose mode
	else if(argc == 3){

		input1 = fopen(argv[2],"r");
		//printf("%s\n", argv[1]);

		if(input1 == NULL)
			return 0;
		else if ( strcmp(argv[1], "-v") == 0){
			//process();
			//printf("Verbose mode and file is not null \n");
			if (checkFile() == FALSE){
				fprintf(stderr,"Wrong format\n");
				return 0;
			}
			//printf("Correct format\n");
			rewind(input1);
			process();
			fclose(input1);
		}
		//when argument is not "-v"
		else{
			fprintf(stderr, "-V is expected on the 2nd argument %s\n", argv[1]);
			return 0;
		}
	}

	return 0;
}
开发者ID:kimyu92,项目名称:CS-429-Computer-Organization-and-Architecture,代码行数:52,代码来源:pdp8.c


示例5: checkFile

bool CppCheck::findError(std::string code, const char FileName[])
{
    std::set<unsigned long long> checksums;
    // First make sure that error occurs with the original code
    checkFile(code, FileName, checksums);
    if (_errorList.empty()) {
        // Error does not occur with this code
        return false;
    }

    std::string previousCode = code;
    std::string error = _errorList.front();
    for (;;) {

        // Try to remove included files from the source
        std::size_t found = previousCode.rfind("\n#endfile");
        if (found == std::string::npos) {
            // No modifications can be done to the code
        } else {
            // Modify code and re-check it to see if error
            // is still there.
            code = previousCode.substr(found+9);
            _errorList.clear();
            checksums.clear();
            checkFile(code, FileName, checksums);
        }

        if (_errorList.empty()) {
            // Latest code didn't fail anymore. Fall back
            // to previous code
            code = previousCode;
        } else {
            error = _errorList.front();
        }

        // Add '\n' so that "\n#file" on first line would be found
        code = "// " + error + "\n" + code;
        replaceAll(code, "\n#file", "\n// #file");
        replaceAll(code, "\n#endfile", "\n// #endfile");

        // We have reduced the code as much as we can. Print out
        // the code and quit.
        _errorLogger.reportOut(code);
        break;
    }

    return true;
}
开发者ID:peernode,项目名称:cppcheck,代码行数:48,代码来源:cppcheck.cpp


示例6: FindFirstFile

MapPackLoader::FileList MapPackLoader::getFiles(int player_number)
{
	FileList files;
	WIN32_FIND_DATA file;
	HANDLE search_handle = FindFirstFile("*.txt", &file);

	if (search_handle != nullptr)
	{
		do
		{
			MapFile map;
			bool result = false;
			try
			{
				map = checkFile(file, player_number, result);
			}
			catch (const std::exception&)
			{
				result = false;
			}
			if (result)
				files.push_back(map);
		} while (FindNextFile(search_handle, &file));
		if (!IsDebuggerPresent())
			CloseHandle(search_handle);
	}

	return files;
}
开发者ID:LeszekGzik,项目名称:PK4-Projekt-Civilisation-,代码行数:29,代码来源:MapPackLoader.cpp


示例7: QDialog

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    myDB = QSqlDatabase::addDatabase("QSQLITE");

    QString pathToDB = QDir::currentPath()+QString("/Accounts.sqlite");
    myDB.setDatabaseName(pathToDB);

    QFileInfo checkFile(pathToDB);

    if (checkFile.isFile()) {
        if (myDB.open()) {
            ui->lblResult->setText("[+] Connected to Database File");
        }
        else {
            ui->lblResult->setText("[!] Database File was not opened");
        }
    }
    else {
        ui->lblResult->setText("[!] Database File does not exist");
    }
}
开发者ID:8Observer8,项目名称:DatabaseLoginForm,代码行数:25,代码来源:dialog.cpp


示例8: fillCategories

fillCategories(char* file_path)
{
    char* linebuffy;
    FILE* f;
    size_t chars;
    char* token;
    char* cat;
    size_t len = 0;
    linebuffy = NULL;

    if (!checkFile(file_path))
    {
        printf("Error with filepath \n", file_path);
        exit(EXIT_FAILURE);
    }

    f = fopen(file_path, "r");

     while ( (chars = getline(&linebuffy, &len, f)) != -1 ) 
     {
        token = strtok(linebuffy, "\n\r");
        cat = strdup(token);
        category_array[num_categories] = cat;
        num_categories++;
     }

     free(linebuffy);
}
开发者ID:xyfer,项目名称:bookstore,代码行数:28,代码来源:bookorder.c


示例9: checkFile

bool PrefsFile::writePrefVal(const QString &prefId, const QString &newVal) {
    if (filePath == NULL)
        return false;

    QString cnt;
    QFileInfo checkFile(filePath);
    if (!checkFile.exists()) {
        return false;
    } else {
        QString oldVal = this->fetchPrefVal(prefId);
        QFile f(filePath);
        if (f.open( QIODevice::ReadWrite )) {
            QTextStream rd(&f);
            cnt = rd.readAll();
        }
        f.resize(0); //truncate
        f.close();

        QString oldL(prefId + " " + oldVal);
        QString newL(prefId + " " + newVal);
        cnt.replace(oldL, newL);

        if (f.open( QIODevice::ReadWrite )) {
            QTextStream wr(&f);
            wr << cnt;
            return true;
        }
    }
}
开发者ID:Jan-Kow,项目名称:turtledoc,代码行数:29,代码来源:Prefs.cpp


示例10: qDebug

/*
 * void MainWindow::on_fileInputEdit_editingFinished()
 * When user (or program) has finished editing this field input will be checked
 * to see if it's a string or a file
 */
void MainWindow::on_fileInputEdit_editingFinished()
{
    QString input;
    input = ui->fileInputEdit->text();
    qDebug() << "\nUser's input: " << input;
    QFileInfo checkFile(input);
    //let's find out if we are working with a file or a string
    if(checkFile.exists() && checkFile.isFile()) {
        fileToGenerateFrom = new QFile(input);

        if(fileToGenerateFrom->open(QIODevice::ReadOnly)){
            qDebug() << "on_fileInputEdit_editingFinished: Opened target file\n";
            byteInput = fileToGenerateFrom->readAll();
            stringToDB =fileToGenerateFrom->fileName();
            fileToGenerateFrom->close();
        }
        else {
            QMessageBox::critical(this,tr("Error opening a file!"),tr("Read error!"));
        }
    }
    //we are working with a string
    else {
        if(input != "") {
            byteInput.append(input);
            stringToDB = input;
        }

    }
}
开发者ID:MikPak,项目名称:MD5-generator,代码行数:34,代码来源:mainwindow.cpp


示例11: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);


        myDB = QSqlDatabase::addDatabase("QSQLITE");
        myDB.setDatabaseName(Path_to_DB);
        QFileInfo checkFile(Path_to_DB);

        if(checkFile.isFile())
        {
            if(myDB.open())
            {
                ui->lblResult->setText("[+]Connected to Database File :)");
            }
        }
        else
        {
            ui -> lblResult -> setText("[!]Database file does not exits :(");
        }


}
开发者ID:SoftwareEngineeringProjectIUS,项目名称:BankProject,代码行数:26,代码来源:mainwindow.cpp


示例12: LOG

bool StorageGroup::FileExists(QString filename)
{
    LOG(VB_FILE, LOG_DEBUG, LOC +
        QString("FileExist: Testing for '%1'").arg(filename));
    bool badPath = true;

    if (filename.isEmpty())
        return false;

    for (QStringList::Iterator it = m_dirlist.begin(); it != m_dirlist.end(); ++it)
    {
        if (filename.startsWith(*it))
        {
            badPath = false;
        }
    }

    if (badPath)
        return false;

    bool result = false;

    QFile checkFile(filename);
    if (checkFile.exists(filename))
        result = true;

    return result;
}
开发者ID:gdenning,项目名称:mythtv,代码行数:28,代码来源:storagegroup.cpp


示例13: main

int main()
{
	//create an input stream object
	std::ifstream ifs;

	//open file for input
	std::string fileName = "regDB.csv";
	ifs.open(fileName, std::ios::in);
	checkFile(ifs);

	//parse data and read from file
	std::cout << "*** Reading from " << fileName << " ***\n\n";
	std::vector<std::string> data = parseInputFile(ifs);

	//print parsed data to stdout
	int j = 0;
	for (auto i = data.begin(); i != data.end(); ++i) {
		std::cout << *i;
		if (!(++j % 3)) //print a newrecord after processing three fields
			std::cout << '\n';
		else
			std::cout << ' ';
	}

	ifs.close();
}
开发者ID:henri562,项目名称:cplusplus-file-io-manipulation,代码行数:26,代码来源:SequentialFileRead.cpp


示例14: MPI_Comm_dup

   void CFile::readAttributesOfEnabledFieldsInReadMode()
   {
     if (enabledFields.empty()) return;

     // Just check file and try to open it
     CContext* context = CContext::getCurrent();
     CContextClient* client=context->client;

     // It would probably be better to call initFile() somehow
     MPI_Comm_dup(client->intraComm, &fileComm);
     if (time_counter_name.isEmpty()) time_counter_name = "time_counter";

     checkFile();

     for (int idx = 0; idx < enabledFields.size(); ++idx)
     {
        // First of all, find out which domain and axis associated with this field
        enabledFields[idx]->solveGridReference();

        // Read attributes of domain and axis from this file
        this->data_in->readFieldAttributesMetaData(enabledFields[idx]);

        // Now complete domain and axis associated with this field
        enabledFields[idx]->solveGenerateGrid();

        // Read necessary value from file
        this->data_in->readFieldAttributesValues(enabledFields[idx]);

        // Fill attributes for base reference
        enabledFields[idx]->solveGridDomainAxisBaseRef();
     }

     // Now everything is ok, close it
     close();
   }
开发者ID:RemiLacroix-IDRIS,项目名称:XIOS,代码行数:35,代码来源:file.cpp


示例15: temp

void DBQuery::connect()
{    
    //QDir::setCurrent(QCoreApplication::applicationDirPath());

    QFile temp("svamp.temp");
    if(temp.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream fin(&temp);
        dbPath = fin.readLine();

        if(dbPath.isEmpty())
            this->closeDB();
        else
            myDB.setDatabaseName(dbPath);
        temp.close();
    }
    QFileInfo checkFile(dbPath);
    if(checkFile.isFile())
    {
        if(myDB.open())
        {
            emit statusUpdate("Database connection successfull");
            qDebug() << "Database connection succesfull";
        }
    }else{
        emit statusUpdate("Database file doesn't exist");
        qDebug() << "Db file not found";
    }

}
开发者ID:raeece,项目名称:svamp,代码行数:30,代码来源:dbquery.cpp


示例16: main

int main()
{
	//create an output stream object
	std::ofstream ofs;

	//open file for output
	std::string fileName = "regDB.csv";
	ofs.open(fileName, std::ios::out);
	checkFile(ofs);
	char data[S];

	//prompt user for data and write to file
	std::cout << "*** Writing to file ***\n\n";
	std::cout << "Enter first name: ";
	writeData(ofs, data, false);

	std::cout << "Enter last name: ";
	writeData(ofs, data, false);

	std::cout << "Enter email address: ";
	writeData(ofs, data, true);

	std::cout << "\nYour data has been saved in " << fileName << std::endl;
	
	ofs.close();
}
开发者ID:henri562,项目名称:cplusplus-file-io-manipulation,代码行数:26,代码来源:SequentialFileWrite.cpp


示例17: checkFile

void Model::readDatabase(const QString &databaseFile)
{
    QFileInfo checkFile(databaseFile);
    if (!checkFile.isFile())    {
        emit errorMessage("Cannot open database file.");
        return;
    }

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(databaseFile);
    const bool ok = db.open();
    if (!ok) {
        emit errorMessage("Cannot read database file.");
        return;
    }

    QSqlQuery query;
    if (!query.exec("SELECT id, vod_path FROM VideoMessages")) {
        db.close();
        emit errorMessage("Cannot query video path from database.");
        return;
    }

    reset();

    while (query.next()) {
        const QString id = query.value(0).toString();
        const QString vodPath = query.value(1).toString();
        addItem(id, vodPath);
    }

    db.close();
}
开发者ID:alex-krutikov,项目名称:SkypeVideoDownloader,代码行数:33,代码来源:model.cpp


示例18: dumpFile

void dumpFile(const char *filepath, char **pbuffer, size_t *plength)
{
	if (!checkFile(filepath))
	{
#ifdef DEBUG
		fprintf(stderr, "glkit: Failed to read %s.\n", filepath);
#endif
		*pbuffer = NULL;
		*plength = 0;
		return;
	}

	FILE *fileHandle = fopen(filepath, "r");
	fseek(fileHandle, 0, SEEK_END);
	size_t fileLength = ftell(fileHandle);
	fseek(fileHandle, 0, SEEK_SET);

	*pbuffer = new char [fileLength + 1];
	fread(*pbuffer, 1, fileLength, fileHandle);
	(*pbuffer)[fileLength] = '\0';
	fclose (fileHandle);

	if (plength)
	{
		*plength = fileLength;
	}
}
开发者ID:eugeneyche,项目名称:glkit,代码行数:27,代码来源:utils.cpp


示例19: main

int main (int argc, char *argv[]) {
    FILE *fp;
    char *filename;

	//
	if (argc < 2) {
		usage (argc, argv);
		exit(1);
	}

    filename = argv[1];
	fp = fopen (filename, "rb");
    if (!fp) {
        fprintf (stderr, "Error: Failed opening %s\n", argv[1]);
        return 1;
    }

	// file checks
	if (checkFile (fp) < 0) {
		fprintf(stderr, "Error: File analysis failed\n");
		exit(1);
	}

	// dump file :)
	if (PeCheck(fp)) {
		pe_dump(fp);
	}
	else if (ElfCheck(fp)) {
		elf_dump(fp);
	}

	fclose(fp);	

	return 0;
}
开发者ID:m101,项目名称:libbparse,代码行数:35,代码来源:read_elfpe.c


示例20: File_write

/* yeah this function is a little weird, but I'm mimicking Lua's actual code for io:write() */
WSLUA_METHOD File_write(lua_State* L) {
    /* Writes to the File, similar to Lua's file:write().  See Lua 5.x ref manual for file:write(). */
    File f = checkFile(L,1);
    int arg = 2;                   /* beginning index for arguments */
    int nargs = lua_gettop(L) - 1;
    int status = TRUE;
    int err = 0;

    if (!f->wdh) {
        g_warning("Error in File read: this File object instance is for reading only");
        return 0;
    }

    lua_pushvalue(L, 1);  /* push File at the stack top (to be returned) */

    for (; nargs--; arg++) {
        size_t len;
        const char *s = luaL_checklstring(L, arg, &len);
        status = wtap_dump_file_write(f->wdh, s, len, &err);
        if (!status) break;
        f->wdh->bytes_dumped += len;
    }

    if (!status) {
        lua_pop(L,1); /* pop the extraneous File object */
        lua_pushnil(L);
        lua_pushfstring(L, "File write error: %s", g_strerror(err));
        lua_pushinteger(L, err);
        return 3;
    }

    return 1;  /* File object already on stack top */
}
开发者ID:CharaD7,项目名称:wireshark,代码行数:34,代码来源:wslua_file.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ checkFloatPos函数代码示例发布时间:2022-05-30
下一篇:
C++ checkFieldInfo函数代码示例发布时间: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