当前位置: 首页>>代码示例>>C++>>正文


C++ ifstream::eof方法代码示例

本文整理汇总了C++中ifstream::eof方法的典型用法代码示例。如果您正苦于以下问题:C++ ifstream::eof方法的具体用法?C++ ifstream::eof怎么用?C++ ifstream::eof使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ifstream的用法示例。


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

示例1: get_very_next_character

char bibfile_parser::get_very_next_character(void)
{
  char c = char(bibfile.get());
  if (bibfile.eof()) {
    reached_end_of_file = true;
    return 0;
  }
  if (!bibfile.good()) {
    cerr << endl << "error reading input bibfile" << endl;
    exit(0);
  }
  return  c;
}
开发者ID:contaconta,项目名称:neurons,代码行数:13,代码来源:bibfile_cleaner.cpp

示例2: readdata_ouput

string readdata_ouput() // read data from file
{

	var_read.open("output.txt");
	var_int_loop_i = 0;
	if (var_read.eof()) {
		return 0;
	}
	while (!var_read.eof()) {
		var_read >> var_char_read;
		if (var_char_read >= 'A' && var_char_read <= 'Z') {
			var_char_read += 32;
		}
		if (var_char_read >= 'a' && var_char_read <= 'z') {
			encrypted1[var_int_loop_i] = var_char_read;
			var_int_loop_i++;
		}
	}
	encrypted1[var_int_loop_i - 1] = '\0';
	var_read.close();
	return encrypted1;
}
开发者ID:ketan936,项目名称:college-work,代码行数:22,代码来源:some_cipher.cpp

示例3: getPrice

void getPrice(ifstream& file, int prices[], int entry) //Get the individual component prices
{
	int temp = 0;
	int count = 0;
	GotoLine(file, entry);

	while (!file.eof())
	{
		file >> temp;
		prices[count] = temp;
		count++;
	}
}
开发者ID:TITANJC,项目名称:School,代码行数:13,代码来源:NQLPMain.cpp

示例4: while

Piece::Piece(ifstream &in) : width_(0), height_(0), sin_(0), cos_(1), flip_(1) {
    string line;
    while (!in.eof()) {
        getline(in, line);
        size_t occ = line.find_last_of('#');
        if (!line.length() || string::npos==occ) break;
        width_ = max(width_, (int)occ+1);
        for (int i=0; i<(int)line.length(); i++) {
            if (line[i]=='#') coords_.push_back(Vec2i(i, height_));
        }
        height_++;
    }
}
开发者ID:ssloy,项目名称:pentominos,代码行数:13,代码来源:piece.cpp

示例5: ComputePctScore

float ComputePctScore(ifstream& input, int numScores)
{
  int total=0, possible=0;
  int score, high;
  float pct;
  while (!input.eof())
    {
      input >> score >> high;
      total += score;
      possible += high;
    }
  pct = 100.0 * total/possible;
}
开发者ID:EricRobertBrewer,项目名称:SonomaState,代码行数:13,代码来源:Lab8b.cpp

示例6: main

int main(int argc, char **argv)
{
    setArgs(argc, argv);
    hintFile.open(fileName.c_str(), ios::in | ios::binary);

    while(!hintFile.eof())
    {
        EvictionRecord *er = new EvictionRecord();
        hintFile.read( (char *)er,sizeof(EvictionRecord));
        er->print();
    }
    hintFile.close();
}
开发者ID:nhajinazar,项目名称:cusim,代码行数:13,代码来源:analyser.cpp

示例7: ReadInput

/*POT_LJ_SPLINE ReadInput: READS AND STORES POTENTIAL PARAMETER VALUES*/
string POT_LJ_SPLINE::ReadInput(ifstream &Input) {
  string str;
  while(!Input.eof()) {
    str = Read_Next(Input);
    if(str.compare(0, 7, "epsilon", 7)==0) {Fill(epsilon, Input);} else
    if(str.compare(0, 5, "sigma"  , 5)==0) {Fill(sigma  , Input);} else
    if(str.compare(0, 3, "cutoff" , 3)==0) {Fill(cutoff , Input);} else
    if(str.compare(0, 3, "Acutoff", 3)==0) {Fill(Acutoff, Input);} else
    if(str.compare(0, 3, "rspline", 3)==0) {Fill(rspline, Input);} else
    {break;}
  }
  return(str);
}
开发者ID:jasonlarkin,项目名称:ald-si,代码行数:14,代码来源:Lennard_Jones_Spline.cpp

示例8: insertNext

void insertNext(PQ & pq, ifstream & fin, int limit)
{
	if (limit == 0)
		limit = numeric_limits<int>::max();
	string word;
	int ct;
	while (!fin.eof() && pq.size < limit)
	{
		pq.size++;
		fin >> word >> ct;
		pq.insert(ItemType(word, ct));
	}
}
开发者ID:jenniferballing,项目名称:CS3Assignment5,代码行数:13,代码来源:TestPQ.cpp

示例9: ReadTranslations

void CDictionary::ReadTranslations(ifstream & input)
{
    string phrase, key, translation;
    while (!input.eof())
    {
        getline(input, phrase);
        translation = "oormveienrovenive";
        if (ParseTranslation(phrase, key, translation))
        {
            m_dictionary[key] = translation;
        }
    }
}
开发者ID:ivan-uskov,项目名称:C-labs,代码行数:13,代码来源:Dictionary.cpp

示例10: main

int main()
{
    #ifdef _PARSARE_
    freopen(nume ".in","r",stdin);
    cit(n);
    #endif
    
    vector<int> v;
    while(!fin.eof())
    {
        fin>>n;
        if(fin.eof())
            break;
        v.clear();
        for(int i=0;i<n;++i)
            fin>>x,v.push_back(x);
        fout<<mergesort(v).second<<'\n';
    }

    fout.close();
    return 0;
}
开发者ID:laurion,项目名称:F12-Contest-Problems,代码行数:22,代码来源:badass_inversiuni.cpp

示例11: ReturnValueTable

void ValueTable::ReturnValueTable(ifstream& f)
{
    m_str = "";
    char ch;

    while(!f.eof() && f.get(ch))
    {
        ++m_TableMap[ch];
        m_str += ch;
    }

    return;
}
开发者ID:MariaPetlovana,项目名称:HaffmanAlgorithm,代码行数:13,代码来源:ValueTable.cpp

示例12: LoadNextSeq

ref_loc_t RefSeq::LoadNextSeq(ifstream &fin) {
    char ch[1000]; char c; string s;
    if(param.gz_ref) return 0;
    fin>>c; if(fin.eof()) return 0;
    string::iterator z=_seq.begin();
    _length=0;
    fin>>_name; fin.getline(ch, 1000);
    while(!fin.eof()) {
        fin>>c; if(fin.eof()) break;
        fin.unget(); if(c=='>') break;
        fin>>s;
        if(_length+s.size()>=param.max_dbseq_size) {
            param.max_dbseq_size+=param.append_dbseq_size;
            _seq.resize(param.max_dbseq_size);
            z=_seq.begin()+_length;
            //cout<<"_seq size: "<<param.max_dbseq_size<<endl;
        }
        copy(s.begin(), s.end(), z);
        z+=s.size(); _length+=s.size();
    }
    return _length;
}
开发者ID:zyndagj,项目名称:BSMAP,代码行数:22,代码来源:dbseq.cpp

示例13: readPoints

    bool readPoints(ifstream &fin)
    {
        int state=0;
        char line[255];
        int nPointsC2;

        while (!fin.eof())
        {
            fin.getline(line,sizeof(line),'\n');
            Bottle b(line);
            Value firstItem=b.get(0);
            bool isNumber=firstItem.isInt() || firstItem.isDouble();

            if (state==0)
            {
                string tmp=firstItem.asString().c_str();
                std::transform(tmp.begin(),tmp.end(),tmp.begin(),::toupper);
                if (tmp=="OFF")
                    state++;
            }
            else if (state==1)
            {
                if (isNumber)
                {
                    nPointsC2=nPointsC=firstItem.asInt();;
                    state++;
                }
            }
            else if (state==2)
            {
                if (isNumber && (b.size()>=3))
                {
                    Vector point;
                    point.resize(3,0.0);

                    point[0]=b.get(0).asDouble();
                    point[1]=b.get(1).asDouble();
                    point[2]=b.get(2).asDouble();

                    point_cloud.push_back(point);

                    if (--nPointsC2<=0)
                        return true;
                }
            }
        }


        return false;

    }
开发者ID:giuliavezzani,项目名称:ipopt-works,代码行数:51,代码来源:main_eps_nosqrt.cpp

示例14: ReadDataFile

void ReadDataFile(){
	cout << "Opening data file 'data_" << FileNumber << ".txt'..." << endl;
	string file = "data_" + FileNumber + ".txt";
	DataFile.open(file.c_str());
	if (!DataFile){
		TerminateError("Unable to open data file.");
	}
	ListNode<ListNodeData> *node = NULL;
	//Find the last node to append the list, if the list is already with items. 
	TheList.Rewind();
	while (TheList.Current() != NULL){
		node = TheList.Current();
		TheList.Next();
	}
	string text, dummy;
	int number;
	//Read data file into list
	while (!DataFile.eof()){
		GetLine(DataFile, text);		//GetLine gets rid of newline character.
		if (DataFile.eof()){			//EOF was reached before a number is read!? Means file is malformed. Ignoring final node.
			cout << "Unexpected end of file for data file. Finishing read." << endl;
			break;
		}
		DataFile >> number;
		getline(DataFile, dummy);	//Use GetLine to clear the newline character.
		//The default behaviour of inserting new nodes to the list is by inserting it at the first node.
		//So we need a "workaround" to build the list as it was defined in the data file.
		cout << "Appending Node " << text << " " << number << endl;
		if (node == NULL){
			node = TheList.InsertNewNode(ListNodeData(number, text));		//This is the first node.
		}
		else{
			node = TheList.AppendNode(node, ListNodeData(number, text));	//Append additional node behind the first node
		}
		
	}
	DataFile.close();
}
开发者ID:lawliet89,项目名称:LinkedList,代码行数:38,代码来源:Operation.cpp

示例15: add_plus_plus

void add_plus_plus(ifstream& in_stream, ofstream& out_stream)
{
    char next;
    in_stream.get(next);
    while (! in_stream.eof( ))
    {
        if (next == 'C')
            out_stream << "C++";
        else
            out_stream << next;

        in_stream.get(next);
    }
}
开发者ID:Zezyn,项目名称:CPlusPlus,代码行数:14,代码来源:06-08.cpp


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