本文整理汇总了C++中ifstream::unsetf方法的典型用法代码示例。如果您正苦于以下问题:C++ ifstream::unsetf方法的具体用法?C++ ifstream::unsetf怎么用?C++ ifstream::unsetf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ifstream
的用法示例。
在下文中一共展示了ifstream::unsetf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFile
void Indentation::readFile(ifstream &inp)
{int i;
inp.unsetf(ios::skipws); //include white space in read
for(i=0;!inp.eof();i++)
inp>>store[i];
numofchar=i-1;
}
示例2: sprawdz_baze
size_t sprawdz_baze(ifstream &baza_pytan){
if( !baza_pytan.good() ) {cout << "bazaZla\n"; return -1;}
baza_pytan.clear();
baza_pytan.seekg(0, ios::beg);
baza_pytan.unsetf(std::ios_base::skipws);
size_t line_count = count(istream_iterator<char>(baza_pytan),istream_iterator<char>(), '\n');
baza_pytan.clear();
baza_pytan.seekg(0,ios::beg);
return line_count;
}
示例3: process
void process(ifstream &icin, int type) //预处理一个标号为type_id的文档
{
doc_count[type]++;
map<int, int> count;
int m = 0;
char ch;
string now="";
icin.unsetf(ios::skipws);
while (icin>>ch)
{
if (valid(ch)) now+=ch;
else
{
if (now!="") insert(m, count, now);
now="";
}
}
if (now!="") insert(m, count, now);
printf("%d ",type);
for (map<int,int>::iterator it = count.begin(); it != count.end(); it++)
printf(" %d:%lf", it->first, it->second*1.0/m);
printf("\n");
}
示例4: main
int main ()
{
fOut.open ( "6assign.out", ios::out );
if ( !fOut )
{
cerr << "Can't open file." << endl;
exit (-1); // Stops program if can't open file 6assign.out
}
const int MAX_SIZE = 30;
char inFileName[MAX_SIZE];
const int MAX_INPUT_SIZE = 100;
double a[MAX_INPUT_SIZE];
cout << "Input file name(s) separated by one space: ";
cin.get ( inFileName, MAX_SIZE );
cout << "Data will be read from: " << inFileName << endl;
// Get data from input file
fIn.open ( inFileName, ios::in );
fIn.unsetf ( ios::skipws );
if ( !fIn )
{
cerr << "Can't open input file." << endl;
exit (-1);
}
// Print standard header information
ShowHeader ( fOut );
// Calls function that calculates mininum, maxinimum and averave values
//MaxMinAve ( a, MAX_INPUT_SIZE );
// Call function that will read in the arrray
//readArray ( a, MAX_INPUT_SIZE )
// Call findMin function for minimum value
Min1 = findMin ( a, MAX_INPUT_SIZE );
fOut << "The minimum is: " << Min1 << endl;
// Call findMax function for maximum value
Max1 = findMax ( a, MAX_INPUT_SIZE );
fOut << "The maximum is: " << Max1 << endl;
// Call calAve function for average value
Ave1 = calAve ( a, MAX_INPUT_SIZE );
fOut << "The average is: " << Ave1 << endl;
// Call function that calculates the standard deviation
stDev1 = CalStandDev ( a, MAX_INPUT_SIZE );
fOut << "The standard deviation is: " << stDev1 << endl;
// Close the input file
fIn.close();
// Close the output file
fOut.close();
return 0;
}