Esempio n. 1
0
int HomoAndMicrosateDis(int argc, char *argv[]) {
    if (argc == 1) DisUsage();
    for (int i=0; i<argc; i++) {
        std::cout <<argv[i]<<' ';
    }
    Initial_Time();
    std::cout <<"Start at:  "<<Curr_Time()<< std::endl;
    int noptions = dGetOptions(argc, argv);
    // process user defined region
    if (!one_region.empty()) {  
        if (!polyscan.ParseOneRegion(one_region)) {
            std::cerr<<"fatal error: Please give correct defined region format (-r) \n";
            exit(1);
        }
        polyscan.ifUserDefinedRegion = true;
    } else {
        polyscan.ifUserDefinedRegion = false;
    }
    // reading bed file if is exist
    finB.open(bedFile.c_str());
    if (finB) {
        std::cout << "loading bed regions ..." << std::endl;
        polyscan.LoadBeds(finB);
        polyscan.BedFilterorNot();
    }
    // check bam list file
    finM.open(bamListFile.c_str());
    if (!finM) {
        std::cerr<<"fatal error: failed to open bam list file\n";
        exit(1);
    }
    std::cout << "loading bam list ..." << std::endl;
    polyscan.LoadBams(finM);
    // check h**o/microsate file
    finH.open(homoFile.c_str());
    if (!finH) {
        std::cerr<<"fatal error: failed to open homopolymer and microsatellites file\n";
        exit(1);
    }
    std::cout << "loading homopolymer and microsatellite sites ..." << std::endl;
    polyscan.LoadHomosAndMicrosates(finH);
    finH.close();
    //polyscan.TestHomos();
    polyscan.SplitWindows();
    //polyscan.TestWindows();
    std::cout << "\nTotal loading windows:  " << polyscan.totalWindowsNum << " \n\n";
    std::cout << "\nTotal loading homopolymer and microsatellites:  " << polyscan.totalHomosites << " \n\n";
    // pour out distribution
    foutD.open( disFile.c_str() );
    if (!foutD) {
        std::cerr <<"failed to open file: "<<disFile<< std::endl;
        exit(1);
    }
    polyscan.GetHomoDistribution(foutD);
    foutD.close();
    std::cout << "\nTotal time consumed:  " << Cal_AllTime() << " secs\n\n";

    return 0;
}
Esempio n. 2
0
	// Read edgelist input file
	inline void readFile(char* filePath, nodeCollection* ncp){
		inputFileStream1.open(filePath);
			std::string line;
			std::string x, y, del;
			int maxValue, a, b;
			char oneLine[256];
			maxValue = 0;

			//To find max Value (to make dynamic array)
			if(inputFileStream1.is_open()){
				int lineNumber = 0;
				while(getline(inputFileStream1, line)){
					strcpy(oneLine,line.c_str());
					del = strtok(oneLine,"\t ");
					x = del;
					y = strtok(NULL,"\t ");
					lineNumber++;
					a = atoi(x.c_str());
					b = atoi(y.c_str());
					
					if ( a > b){
						if(a > maxValue){
							maxValue = a;}
					}
					else{
						if(b > maxValue){
							maxValue = b;}
					}
				}
			}
			else{
				std::cout<<"Error Occured!"<<std::endl;
			}

			//ncp->setAdjMat(maxValue);	//Make matrix
			ncp->setDegMat(maxValue);	//Make degMatrix
			inputFileStream1.seekg(0, inputFileStream1.beg);		//to read again
			inputFileStream1.close();
			inputFileStream2.open(filePath);
			if(inputFileStream2.is_open()){
				while(getline(inputFileStream2, line)){	
					strcpy(oneLine,line.c_str());
					del = strtok(oneLine,"\t ");
					x = del;
					y = strtok(NULL,"\t ");
					a = atoi(x.c_str());
					b = atoi(y.c_str());
					ncp->putNode(a, b);
					ncp->putNode(b, a);
					}
			}
			else{
				std::cout<<"Error Occured!"<<std::endl;
			}
			std::cout<<"####  FILE READ & SETUP FINISHED####"<<std::endl;
			inputFileStream2.close();
			
	}
Esempio n. 3
0
void init_sim(int argc, char **argv) {
	topology_file.open(argv[1], std::ifstream::in);
	messages_file.open(argv[2], std::ifstream::in);
	events_file.open(argv[3], std::ifstream::in);

	topology_file >> node_ct;
	messages_file >> msg_ct;
	events_file >> time_ct;
	events_file >> event_ct;

	routers.clear();

	//creem obiectele de tip Router
	for(int i = 0; i < node_ct; ++i) routers.push_back( Router(i, node_ct) );

	int r1, cost, r2;
	while( (topology_file >> r1 >> cost >> r2) ) {
		//anuntam routerele despre vecinii lor directi
		routers[r1].add_nbrh(r2, cost);
		routers[r2].add_nbrh(r1, cost);
	} 

	//std::cout << "  [init_sim] sau initilizat " << routers.size() << " routere . . .\n";

	//incepem flodarea retelei cu mesaje despre vecini
	char nbrh_msg[LEN];

	for(unsigned int i = 0; i < routers.size(); ++i) {
		routers[i].table.set_node_no(node_ct);
		routers[i].topology.set_node_no(node_ct);
		routers[i].known_tags.clear();
	}

	for(unsigned int i = 0; i < routers.size(); ++i) {
		make_null(nbrh_msg, LEN);

		//fiecarui mesaj din prima parte a algoritmului de flodare
		//ii setam tagul egal cu -id-ul routerului care la pornit
		//in acest fel mesajele ce contin toti vecini vor avea tagul un numar negativ sau 0
		sprintf(nbrh_msg, "%d ", -i);  //tag == -i

		sprintf(nbrh_msg + strlen(nbrh_msg), "%d %d ", i, routers[i].nbrh.size());

		for(unsigned int j = 0; j < routers[i].nbrh.size(); ++j) {
			sprintf(nbrh_msg + strlen(nbrh_msg), "%d %d ", routers[i].nbrh[j], routers[i].get_nbrh_cost(routers[i].nbrh[j]));
		} 

		for(unsigned int j = 0; j < routers[i].nbrh.size(); ++j) {
			//cout << "----------------de la " << i << " la " << j << " sa trimis " << nbrh_msg << "\n";
			endpoint[i].send_msg(&endpoint[routers[i].nbrh[j]], nbrh_msg, strlen(nbrh_msg), NULL);
		}

	}  


}
Esempio n. 4
0
std::string MiscUtil::OpenFile(std::string name, std::ifstream& f)
{
#ifndef ABS_TOP_SRCDIR
    #error ABS_TOP_SRCDIR not defined!
#endif
#ifndef DATADIR
    #error ABS_TOP_SRCDIR not defined!
#endif
    std::string programDirFile;
    std::string absFile;
    std::string dataFile;
    # if defined(BOOST_FILESYSTEM_VERSION)
        BenzeneAssert (BOOST_FILESYSTEM_VERSION == 2 || BOOST_FILESYSTEM_VERSION == 3);
    #endif
    {
        path p = programDir / name;
        p.normalize();
        #if (defined (BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION == 3))
            programDirFile = p.string();
        #else
            programDirFile = p.native_file_string();
        #endif
        f.open(programDirFile.c_str());
        if (f.is_open())
            return programDirFile;
    }
    {
        path p = boost::filesystem::path(ABS_TOP_SRCDIR) / "share" / name;
        p.normalize();
        #if (defined (BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION == 3))
            absFile = p.string();
        #else
            absFile = p.native_file_string();
        #endif
        f.open(absFile.c_str());
        if (f.is_open())
            return absFile;
    }
    {
        path p = boost::filesystem::path(DATADIR) / name;
        p.normalize();
        #if (defined (BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION == 3))
            dataFile = p.string();
        #else
            dataFile = p.native_file_string();
        #endif
        f.open(dataFile.c_str());
        if (f.is_open())
            return dataFile;
    }
    throw BenzeneException() << "Could not find '" << name << "'. Tried \n"
                             << "\t'" << programDirFile << "' and\n"
                             << "\t'" << absFile << "' and\n"
                             << "\t'" << dataFile << "'.";
}
Esempio n. 5
0
    static void openTextFile(const std::string& filepath, std::ifstream& file){
        
#ifdef _WIN32
        // WIN32 will create the wrong file names if we don't first convert them to UTF-16.
        std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
        std::wstring wide_path = converter.from_bytes(filepath);
        file.open(wide_path, std::ios::in);
#else
        file.open(filepath, std::ios::in);
#endif
    }
Esempio n. 6
0
 /**
  * This method closes and reopens files so that another CompareFiles() command can be run on the same object.
  */
 void ResetFiles()
 {
     if (!mCalledCollectively || PetscTools::AmMaster())
     {
         // We want to reset the files to allow this method to be called again, with different tolerances for instance.
         mpFile1->close();
         mpFile2->close();
         mpFile1->open(mFilename1.c_str());
         mpFile2->open(mFilename2.c_str());
         mLineNum = 1u;
     }
 }
Esempio n. 7
0
	em_blob(const char *path) : completed(0), path_(path) {
		try {
			data.open(path, std::ios_base::in | std::ios_base::binary);
			std::string index_path(path);
			index_path += ".index";
			index.open(index_path.c_str(), std::ios_base::in | std::ios_base::binary);
		} catch (...) {
			data.close();
			index.close();

			throw;
		}
	}
Esempio n. 8
0
bool NodePartitionedMeshReader::openASCIIFiles(std::string const& file_name_base,
    std::ifstream& is_cfg, std::ifstream& is_node, std::ifstream& is_elem) const
{
    const std::string fname_header = file_name_base +  "_partitioned_";
    const std::string fname_num_p_ext = std::to_string(_mpi_comm_size) + ".msh";

    {   // Configuration.
        std::string const filename = fname_header + "cfg" + fname_num_p_ext;
        is_cfg.open(filename);

        if( !is_cfg.good() )
        {
            ERR("Error opening file %s for input.", filename.c_str());
            return false;
        }

        std::string tmp_line;
        std::getline(is_cfg, tmp_line);
        int num_parts;
        is_cfg >> num_parts >> std::ws;

        if(num_parts != _mpi_comm_size)
        {
            ERR("Aborting computation because of number of cores"
                "/ subdomains mismatch.");
            return false;
        }
    }

    {   // Nodes.
        std::string const filename = fname_header + "nodes_" + fname_num_p_ext;
        is_node.open(filename);
        if( !is_node.good() )
        {
            ERR("Error opening file %s for input.", filename.c_str());
            return false;
        }
    }

    {   // Elements.
        std::string const filename = fname_header + "elems_" + fname_num_p_ext;
        is_elem.open(filename);
        if( !is_elem.good() )
        {
            ERR("Error opening file %s for input.", filename.c_str());
            return false;
        }
    }

    return true;
}
Esempio n. 9
0
 void open_ifstream(std::ifstream& stream,const std::string& path,bool binary)
 {
   std::ifstream::openmode mode=std::ifstream::in;
   if(binary)
     mode|=std::ifstream::binary;
   #ifdef WIN32
   std::wstring wpath;
   utf8::utf8to16(path.begin(),path.end(),std::back_inserter(wpath));
   stream.open(wpath.c_str(),mode);
   #else
   stream.open(path.c_str(),mode);
   #endif
   if(!stream.is_open())
     throw open_error(path);
 }
Esempio n. 10
0
void openInputFile(std::ifstream& s, std::string path){
  s.open(path);
  if(s.fail()){
    std::cerr << "Failure opening file \"" << path << "\" for input." << std::endl;
    exit(0);
  }
}
Esempio n. 11
0
   void _ctor(ev4::string<>& _FileName, std::size_t _BufferSize)
   {
      _m_buffer = new char[_BufferSize];
      _m_filename = new ev4::string<>(_FileName);

      _m_file.open(_FileName.c_str());
   }
Esempio n. 12
0
/*Name: fOpen
//Purpose: Opens file with given filename
//Parameters: ifstream object, string filename, bool fail bit
//Returns: null
*/
void fOpen(std::ifstream& fin, string filename, bool& fail){
	fin.open(filename.c_str());
	if(!fin.is_open()){
		fail = 1;
		cerr << "File failed to open";
	}
}
Esempio n. 13
0
 void open( const std::string& anchorFile ) {
   _in.close();
   _in.clear();
   _in.open( anchorFile.c_str() );
   _buffer.clear();
   _readDocumentHeader();
 }
Esempio n. 14
0
int main(int argc, const char* argv[]){
	//Check and parse the command line arguments
	if(argc<MIN_ARGC || argc>MAX_ARGC){
		wrong_usage_msg(argc-1);
	}
	
	//Leaving room for more future command line options
	std::string filename;
	bool inFileSupplied=false;
	for(int i=1;i<argc;i++){
		if(file_exists(argv[i])){
			filename=argv[i];
			inFileSupplied=true;
		}
		else{
			invalid_arg_msg(argv[i]);
		}
	}
	
	if(!inFileSupplied)
		fatal("[ERROR] Input file not defined: "+filename+"\n");
	
	inFile.open(filename);
	
	//Parse the input file into a list of commands
	parse();
	//Execute it!
	execute();
	
	return 0;
}
Esempio n. 15
0
    bool InpNativeInfo::read_file(const std::string& file_name)
    {
        if(already_read)
            std::cout << "Warning: trying to substitute ninfo for already initiated object." 
                      << std::endl;
        already_read = true;

        if(inpfile.is_open())
        {
            std::cout << "Warning: trying to re-open file named " << file_name
                      << std::endl;
        }
        inpfile.open(file_name);
        bool read(false);
        
        while(!inpfile.eof())
        {
            std::string line;
            std::getline(inpfile, line);

            if(line.empty()) continue;
            if(line[0] == '\x2a') continue;

            if(eq_ignorecase(line.substr(0,20), "<<<< native_info_sim"))
            {
                read = true;
                std::string temp(line, 20);
                simN = std::stoi(temp);
                read_block(inpfile);
            }
        }
        return read;
    }
void HeaderGenerator::openInputFileOrThrowException(
  std::ifstream &ifs, const std::string fileName)
{
  ifs.open(fileName);
  if (!ifs)
    throw std::exception("Failed to open file");   
}
int main(int argc, char *argv[])
{
    ros::init(argc, argv, "kml_extractor_node");
    ros::NodeHandle n;
    ros::NodeHandle pn("~");

    signal(SIGINT, sigintHandler);

    std::string header_file_path, footer_file_path;
    pn.param<std::string>("kml_file", kml_filename, "out.kml");
    pn.param<std::string>("coordinates_filename", coordinates_utm_filename, "coordinates_utm.txt");
    pn.param<std::string>("header_file_path", header_file_path, "/home/joao/catkin_ws_isrobotcar/src/kml_extractor/src/header.yaml");
    pn.param<std::string>("footer_file_path", footer_file_path, "/home/joao/catkin_ws_isrobotcar/src/kml_extractor/src/footer.yaml");

    kml_file.open(kml_filename.c_str(), std::ios_base::out | std::ios_base::trunc);
    coordinates_utm_file.open(coordinates_utm_filename.c_str(), std::ios_base::out | std::ios_base::trunc);
    std::ifstream header_kml(header_file_path.c_str());
    footer_kml.open(footer_file_path.c_str(), std::ios_base::in);

    while(header_kml.good())
    {
        char c = header_kml.get();       // get character from file
            if (header_kml.good())
             kml_file << c;
    }
    kml_file << std::endl;

    ros::Subscriber fix_sub = n.subscribe("fix", 30, callbackFix);
    ros::Subscriber odom_sub = n.subscribe("odom", 30, callbackOdom);

    ros::spin();

    return 0;
}
Esempio n. 18
0
VOID InvokeFunTaint()
{
	string infileName = "c:\\pinInput.txt";
	ADDRINT argu0=0;
	ADDRINT argu1=0;


	in.open(infileName.c_str());


	in >> hex;

	in >> argu0;
	in >> argu1;

	in.close();

	out <<"argu0 " <<argu0 <<endl;

	out <<"argu1 " <<argu1 <<endl;

	if(argu1!=0)
	{
		int n = 2*wcslen((wchar_t *)argu1);
		out <<endl<<"senmatic: argu2"<<endl;
		out << "variable address: "<<argu1<<endl;
		out <<"variable type: BSTR"  << endl;
		out <<"variable length-byte: " << n <<endl;
		ADDRINT taint = (ADDRINT)argu1;
		AddTaint(taint,n,type_WORD);
		InsertTaintInstrumentation();//find taint source , then enable DTA and instruction-level taint analysis
	}
}
Esempio n. 19
0
            /**
            * @brief Configures the block: defines the input file.
            * @param n The configuration parameters
            */
            virtual void _configure(const xml_node& n)
            {
                xml_node source = n.child("source");
                xml_node gates_node = n.child("gates");
                if( (!source)  || (!gates_node) )
                    throw std::runtime_error("TweetReader: missing parameter");
                std::string gates_s = gates_node.attribute("number").value();
                std::string type = source.attribute("type").value();
                std::string ip = source.attribute("ip").value();
                file_name = source.attribute("name").value();
                if(!type.length() || !file_name.length() || !gates_s.length())
                    throw std::runtime_error("TweetReader: missing attribute");
                if(type.compare("offline") != 0)
                    throw std::runtime_error("TweetReader: invalid type parameter");

                num_gates = atoi(gates_s.c_str());

                file.open(file_name);
                if(!file.is_open()) {
                    throw std::runtime_error("TweetReader: cannot open source file");
                }

                // Create and register the output gates
                m_outgate_ids = new int[num_gates];
                for(int i=0; i<num_gates; i++){
                    std::string ogate = outgate_basename + boost::lexical_cast<std::string>(i);
                    m_outgate_ids[i] = register_output_gate(ogate.c_str());
                }
            }
Esempio n. 20
0
void ResourceManager::getResourceStream(const std::string& resourceName,
										std::ifstream& stream) const
	throw(exception::ResourceNotFoundException)
{
	string absolutePath = getAbsolutePath(resourceName);
	stream.open(absolutePath.c_str());
}
Esempio n. 21
0
void openfile(const char *filename, std::ifstream &infile){
    infile.open(filename);
    if (! infile.is_open()) {
        std::cout << "Error opening file:" << filename << std::endl;
        exit(1);
    }
}
Esempio n. 22
0
int parseArgs (int argc, char** argv, std::ifstream &vcf, int &genoprior) {
	int rv = 0;

	if (argc < 3) {
		vcf2bimbamInfo();
		return 1;
	}

	vcf.open(argv[1]);
	if (!vcf) {
		std::cerr << "Unable to open input VCF " << argv[1] << "\n";
		return -1;
	}

	if (strcmp(argv[2], "unif") == 0) {
		genoprior = 0;
	} else if (strcmp(argv[2], "hwe") == 0) {
		genoprior = 1;
	} else {
		std::cerr << "Invalid genotype prior " << argv[2] << "\n";
		return -1;
	}

	return rv;
}
Esempio n. 23
0
int loadFiles(const char * fn){
	ifstream is;
	if (fn)
		is.open(fn);
	else
		is.open(filename.c_str());
	if (! is){
		cout << "no file found" << endl;
		return -1;
	}

	GMapping::CarmenConfiguration conf;
	conf.load(is);
	is.close();

	sensorMap=conf.computeSensorMap();

	if (input)
		delete input;

	if (! readFromStdin){
		plainStream.open(filename.c_str());
		input=new GMapping::InputSensorStream(sensorMap, plainStream);
		cout << "Plain Stream opened="<< (bool) plainStream << endl;
	} else {
		input=new GMapping::InputSensorStream(sensorMap, cin);
		cout << "Plain Stream opened on stdin" << endl;
	}
	return 0;
}
Esempio n. 24
0
bool File::read(std::ifstream& stream)
{
  CwdGuard cg(physical_dir_);
  stream.open(ACE_TEXT_ALWAYS_CHAR(physical_file_.c_str()),
              ios::binary | ios::in);
  return !stream.bad() && !stream.fail();
}
//-------------------------INTERFACE------------------------
BOOL IFileManager::ImportFile_3DS(
	NFilePath pFilePath,
	std::vector<NVECTOR3>& outVertexBuffer, 
	std::vector<NVECTOR2>& outTexCoordList, 
	std::vector<UINT>& outIndexBuffer, 
	std::vector<N_MeshSubsetInfo>& outSubsetList, 
	std::vector<N_Material>& outMaterialList,
	std::unordered_map<std::string, NFilePath>& out_TexName2FilePathPairList)
{
	static_meshObjList.clear();
	static_materialList.clear();
	static_TexName2FilePathPairList.clear();

	fileIn.open(pFilePath, std::ios::binary);

	if (!fileIn.good())
	{
		DEBUG_MSG1("Noise File Manager : Import .3ds file failed!!");
		return FALSE;
	}

	fileIn.seekg(0, std::ios::end);
	static_currentChunkFileEndPos = 0;
	static_fileSize = fileIn.tellg();
	fileIn.seekg(0);

	//maybe linearly deal with chunks is also OK....
	//stack will be used when necessary because recursive solution
	//can sometimes be rewritten in non-recursive form using stack.
	while (!fileIn.eof() && fileIn.good())
	{
		ReadChunk();
	}
	fileIn.close();

	//Finish Parsing,check if Vertices/Indices had been loaded
	auto& vertexList = static_meshObjList.back().verticesList;
	if (vertexList.size() == 0 || vertexList.size() == 0)
	{
		DEBUG_MSG1("Noise File Manager :Data Damaged!!!No Vertices or Indices loaded!");
		return FALSE;
	}


	//std::move transform lval into rval to avoid copying happens
	N_Load3ds_MeshObject finalMeshObj;
	IntegratePartialMeshIntoOnePiece(finalMeshObj);
	outIndexBuffer = std::move(finalMeshObj.indicesList);
	outVertexBuffer = std::move(finalMeshObj.verticesList);
	outTexCoordList = std::move(finalMeshObj.texcoordList);
	outSubsetList = std::move(finalMeshObj.subsetList);
	outMaterialList = std::move(static_materialList);
	out_TexName2FilePathPairList = std::move(static_TexName2FilePathPairList);

	//used to generate unique name
	++static_MeshIndex;

	return TRUE;
}
std::string openFileDialog(std::ifstream& stream,
                           const std::string& title,
                           const std::string& path) {
    std::string filename = pp->file_openFileDialog(title, "load", path);
    if (filename == "") return "";
    stream.open(filename.c_str());
    return (stream.fail()) ? "" : filename;
}
Esempio n. 27
0
bool redirect_cin (const std::string& fn)
{
	static std::ifstream alt_cin;
	alt_cin.open (fn.c_str(), std::ios::in | std::ios::binary);
	if (alt_cin.fail() ) return false;
	std::cin.rdbuf (alt_cin.rdbuf() );
	return true;
}
Esempio n. 28
0
    /** Opens the filestream with the first file called @p filename
     found by looking 
     successively in the following directories:
     - the current directory
     - in a subdirectory (of the directory below) with the version of 
     OpenBabel as its name
     - the parent directory specified by the environment variable 
     named @p envvar 
     or "BABEL_DATADIR" if @p envvar is not specified, or the compiled-in
     macro BABEL_DATADIR if the environment variable is not set

     \param ifs        Stream to load
     \param filename   Name of the data file to load
     \param envvar     Name of the environment variable 

     \return the name of the file that was opened. This includes the path
     unless it is in current directory

  **/
  std::string OpenDatafile(std::ifstream& ifs, const std::string& filename, 
                           const std::string& envvar)
  {
    ios_base::openmode imode = ios_base::in;
    #ifdef ALL_READS_BINARY //Makes unix files compatible with VC++6
      imode = ios_base::in|ios_base::binary;
    #endif

    // check the current directory
    ifs.close();
    ifs.clear();
    ifs.open(filename.c_str(),imode);
    if(ifs)
      return filename;

    string file;
    const char* datadir = getenv(envvar.c_str());
    if(!datadir)
      datadir = BABEL_DATADIR;

    // check the subdirectory for this version number
    file = datadir;
    file += FILE_SEP_CHAR;
    file += BABEL_VERSION;
    file += FILE_SEP_CHAR + filename;

    ifs.clear();
    ifs.open(file.c_str(),imode);
    if(ifs)
      return file;

    // couldn't find it with the version built in, so try the parent
    file = datadir;
    file += FILE_SEP_CHAR;
    file += filename;

    ifs.clear();
    ifs.open(file.c_str(),imode);

    if (ifs)
      return file;

    ifs.clear();
    ifs.close();
    return(""); // error
  }
Esempio n. 29
0
bool openInputFile(std::ifstream& _inFile, std::string _path){
	_inFile.open(_path);

	if(!_inFile.is_open() || !_inFile.good())
			return false;

	return true;
}
Esempio n. 30
0
bool openInFile(const std::string &filename, std::ifstream &file){
  file.open(filename.c_str(),std::ifstream::in);
  if(!file.is_open()) {
    printf("Could not open input file %s", filename.c_str());
    return false;
  }
  return true;
}