本文整理汇总了C++中Errors::noRepContFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Errors::noRepContFile方法的具体用法?C++ Errors::noRepContFile怎么用?C++ Errors::noRepContFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Errors
的用法示例。
在下文中一共展示了Errors::noRepContFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileOpenErrExptn
PlugBoard::PlugBoard( char *pbFileName )
{
/* Error and format check file */
Errors checkPlugBoard;
checkPlugBoard.noRepContFile( pbFileName, 'p' );
/* Open plugboard file. Loop through the file, counting
* the total number of values in the file */
ifstream pbfile;
pbfile.open( pbFileName );
int contact;
mapLength = 0; // set @mapLength to zero
if( pbfile.fail() ){ // Throw error if cannot open
throw FileOpenErrExptn( ERROR_OPENING_CONFIGURATION_FILE, pbFileName );
}
while( !pbfile.eof() ){ // Loop through file counting values
if( !pbfile.eof() ){
pbfile >> contact;
mapLength++;
}
}
示例2: FileOpenErrExptn
Reflector::Reflector( char *rfFileName )
{
/* Error and format check file */
Errors checkReflector;
checkReflector.noRepContFile( rfFileName, 'f' );
/* Open given reflector file. */
ifstream reflectorFile;
reflectorFile.open( rfFileName );
if( reflectorFile.fail() ){ // Throw error if cannot open
throw FileOpenErrExptn( ERROR_OPENING_CONFIGURATION_FILE, rfFileName );
}
/* Initialize elements of reflectorMap, by convering the
* int values from given file into uppercase characters
* and assign these characters to elements in @reflectorMap.
* Each column contains a 'wired' pair of characters. */
int contactOne; // first value in 'wired' pair from file
int contactTwo; // second value in 'wired' pair from file
int pair = 0;
while( !reflectorFile.eof() ){
reflectorFile >> contactOne;
reflectorFile >> contactTwo;
if( !reflectorFile.eof() ){
reflectorMap[pair][0] = (contactOne+65); // +65 for u.case convert
reflectorMap[pair][1] = (contactTwo+65);
pair++;
}
}
}