Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Operations on file | get and put pointer
- MyFile . seekg ( 0 , ios :: beg ) ;
- MyFile . seekp ( -10 , ios :: end ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- __________________________________________________________________
- ^ ^
- ^ ^
- ^ ^
- get Pointer put pointer
- Myfile . get ( character ) ;
- MyFile . write ( SomeString, 4 ) ;
- MyFile . flush ( ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- __________________________________________________________________
- ^ ^
- ^ ^
- ^ ^
- get Pointer put pointer
- FileIN . seekg ( 1, ifstream :: cur ) ;
- FileIN . seekg ( 1, ios :: cur ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- _____________________________________________________________________
- ^ file-pointer
- MyFile . seekg ( 0 , ios :: beg ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- _____________________________________________________________________
- ^ file-pointer
- MyFile . seekp ( -10 , ios :: end ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- _____________________________________________________________________
- ^ file-pointer
- Myfile . get ( character ) ;
- // you must sync/flush if your last operation was input and you switch to output,
- // or your last operation was output and you switch to input.
- MyFile . sync ( ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- _____________________________________________________________________
- ^ file-pointer
- MyFile . write ( SomeString, 4 ) ;
- MyFile . flush ( ) ;
- index :0 1 2 3 4 5 6 7 8 9 10 ... -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
- _____________________________________________________________________
- ^ file-pointer
Add Comment
Please, Sign In to add comment