






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Introduction to Programming Lecture 19
ifstream myFilePtr ; myFilePtr.open ( “myFile” , ios :: in ) ;
ios :: app ios :: trunc ios :: ate
tellp ( ) Function myFile.tellp ( ) ; Returns a whole number which tell you the position of the next character to be written in a file
For Positioning in the file seekg ( ) ; seekp ( ) ;
seekg ( ) seekg ( 10L , ios :: beg ) ; seekg (10L , ios :: cur ) ; seekg ( 10L , ios :: end ) ;
#include<fstream.h> main ( ) { int length ; ifstream inFile ( “myFile.txt” ) ; inFile.seekg ( 0L , ios :: end ) ; length = inFile.tellg ( ) ; }
Merge Method This is a text data And needs Original file Empty file To be replaced (^) NOT
seekg ( ) seekg ( 2201L , ios :: beg ) ;
OR Function A B Output 0 0 0 0 1 1 1 0 1 1 1 1
Example 2 This is an Apple This is a Sample