Example #1
1
 void GetUnicodeFileLines(wifstream &File, Vector<UnicodeString> &Output)
 {
     SignalError("wifstream seems to die on ASCII EOF character");
     Output.FreeMemory();
     wstring CurLine;
     while(!File.eof())
     {
         getline<UnicodeCharacter>(File, CurLine);
         if(!File.eof())
         {
             Output.PushEnd(UnicodeString(CurLine.c_str()));
         }
     }
 }
Example #2
0
int loadQuestions(wifstream& file, vector<question>& storage) {
	wstring stringBuffer;
	question questionBuffer;
	unsigned int amountOfAnswers;

	while (!file.eof()) {
		getline(file, stringBuffer);
		amountOfAnswers = wcstol(stringBuffer.c_str(), NULL, 10);

		getline(file, stringBuffer);
		questionBuffer.indexOfCorrectAnswer = wcstol(stringBuffer.c_str(), NULL, 10);

		getline(file, stringBuffer);
		questionBuffer.points = wcstol(stringBuffer.c_str(), NULL, 10);

		getline(file, questionBuffer.textOfQuestion);

		for (unsigned int i = 0; i < amountOfAnswers; ++i) {
			getline(file, stringBuffer);
			questionBuffer.answers.push_back(stringBuffer);
		}

		storage.push_back(questionBuffer);
		questionBuffer.answers.clear();
	}

	return 0;
}
Example #3
0
//
// reads one line from a file
//
bool readLineFromFile( wifstream& file, wstring& line )
{
    line = L"";
    if( file.eof() )
        return( false );

    wchar_t c;
    while( true )
    {
        file.get( c );
        if( file.eof()
                || c == L'\n'
                || c == 0 ) return( true );
        line += c;
    }
    return( true );
}
Example #4
0
wstring readfile(wifstream &fin)
{
    wstring buffer, line;
    while(!fin.eof()) {
        getline(fin, line);
        buffer += line;
    }
    return buffer;
}