fpos::operator!=

같지 않음에 대 한 테스트 파일 위치 표시기입니다.

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

매개 변수

  • _Right
    파일 위치 표시기 비교입니다.

반환 값

true 이면 파일 위치 표시기 그렇지, 다르면 거짓.

설명

멤버 함수를 반환 합니다. !(*this == _Right).

예제

// 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( );
}

입력: fpos_op_neq.txt

987654321

2zxhd58d.collapse_all(ko-kr,VS.110).gifOutput

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

요구 사항

헤더: <ios>

네임 스페이스: std

참고 항목

참조

fpos Class

iostream 프로그래밍

iostreams 규칙