Freigeben über


fpos::operator!=

Testet Stellungsanzeiger auf Ungleichheit.

bool operator!=(
    const fpos<Statetype>& _Right
) const;

Parameter

  • _Right
    Gegen den der Stellungsanzeiger zu vergleichen.

Rückgabewert

true, wenn die Stellungsanzeiger nicht gleich sind; andernfalls false.

Hinweise

Die Memberfunktion gibt !(*this == _Right) zurück.

Beispiel

// fpos_op_neq.cpp
// compile with: /EHsc
#include <fstream>
#include <iostream>

int main( )
{
   using namespace std;

   fpos<int> pos1, pos2;
   ifstream file;
   char c;

   // Compare two fpos object
   if ( pos1 != pos2 )
      cout << "File position pos1 and pos2 are not equal" << endl;
   else
      cout << "File position pos1 and pos2 are equal" << endl;

   file.open( "fpos_op_neq.txt" );
   file.seekg( 0 );   // Goes to a zero-based position in the file
   pos1 = file.tellg( );
   file.get( c);
   cout << c << endl;

   // Increment pos1
   pos1 += 1;
   file.get( c );
   cout << c << endl;

   pos1 = file.tellg( ) - fpos<int>( 2);
   file.seekg( pos1 );
   file.get( c );
   cout << c << endl;

   // Increment pos1
   pos1 = pos1 + fpos<int>( 1 );
   file.get(c);
   cout << c << endl;

   pos1 -= fpos<int>( 2 );
   file.seekg( pos1 );
   file.get( c );
   cout << c << endl;

   file.close( );
}

Eingabe: fpos_op_neq.txt

987654321

Ausgabe

File position pos1 and pos2 are equal
9
8
9
8
8

Anforderungen

Header: <IOS>

Namespace: std

Siehe auch

Referenz

fpos-Klasse

iostream-Programmierung

iostreams-Konventionen