Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
FILE HANDLING IN C++
STREAMS <ul><li>A Stream is a general name given to flow of data. </li></ul><ul><li>Different streams are used to represen...
The Stream Class Hierarchy ios istream get() getline() read() >> ostream put() write() << fstreambase iostream Ifstream Op...
DIFFERENT FILE OPERATIONS <ul><li>OPENING A FILE  </li></ul><ul><li>CLOSING A FILE </li></ul><ul><li>READING FROM A FILE <...
File Mode Parameters <ul><li>PARAMETER MEANING </li></ul><ul><li>Ios::app Append to end-of file </li></ul><ul><li>Ios::ate...
FILE POINTERS
FILE POINTERS <ul><li>Each file object has two integer values associated with it : </li></ul><ul><ul><li>get pointer </li>...
File pointers….. <ul><li>By default reading pointer is set at  the beginning and writing pointer is set at the end (when y...
Functions associated with file pointers : <ul><li>The  seekg()  and  tellg()  functions allow you to set and examine the g...
seekg() function : <ul><li>With one argument : </li></ul><ul><li>seekg(k) where k is absolute position from the beginning....
seekg() function : <ul><li>With two arguments : </li></ul><ul><ul><li>the first argument represents an offset from a parti...
seekg() function : <ul><li>With two arguments : </li></ul>Begin End ^ Offset from Begin The seekg() function with two argu...
Ha terminado este documento.
Descárguela y léala sin conexión.
Próximo SlideShare
file handling c++
Siguiente
Próximo SlideShare
file handling c++
Siguiente
Descargar para leer sin conexión y ver en pantalla completa.

Compartir

File Pointers

Descargar para leer sin conexión

Libros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo

Audiolibros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo

File Pointers

  1. 1. FILE HANDLING IN C++
  2. 2. STREAMS <ul><li>A Stream is a general name given to flow of data. </li></ul><ul><li>Different streams are used to represent different kinds of data flow. </li></ul><ul><li>Each stream is associated with a particular class, which contains member functions and definitions for dealing with that particular kind of data flow. </li></ul>
  3. 3. The Stream Class Hierarchy ios istream get() getline() read() >> ostream put() write() << fstreambase iostream Ifstream Open() Tellg() Seekg() Ofstream Open() Tellp() Seekp() fstream NOTE : UPWARD ARROWS INDICATE THE BASE CLASS
  4. 4. DIFFERENT FILE OPERATIONS <ul><li>OPENING A FILE </li></ul><ul><li>CLOSING A FILE </li></ul><ul><li>READING FROM A FILE </li></ul><ul><li>WRITING ON A FILE </li></ul><ul><li>CHECKING FOR END OF FILE </li></ul>
  5. 5. File Mode Parameters <ul><li>PARAMETER MEANING </li></ul><ul><li>Ios::app Append to end-of file </li></ul><ul><li>Ios::ate goto end of file on opening </li></ul><ul><li>Ios::binary binary file </li></ul><ul><li>Ios::in </li></ul><ul><li>Ios::nocreate open fails if file doesn’t exist </li></ul><ul><li>Ios::noreplace open fails if file already exists </li></ul><ul><li>Ios::out </li></ul><ul><li>Ios::trunc Deletes contents if it exists </li></ul>
  6. 6. FILE POINTERS
  7. 7. FILE POINTERS <ul><li>Each file object has two integer values associated with it : </li></ul><ul><ul><li>get pointer </li></ul></ul><ul><ul><li>put pointer </li></ul></ul><ul><li>These values specify the byte number in the file where reading or writing will take place. </li></ul>
  8. 8. File pointers….. <ul><li>By default reading pointer is set at the beginning and writing pointer is set at the end (when you open file in ios::app mode) </li></ul><ul><li>There are times when you must take control of the file pointers yourself so that you can read from and write to an arbitrary location in the file. </li></ul>
  9. 9. Functions associated with file pointers : <ul><li>The seekg() and tellg() functions allow you to set and examine the get pointer. </li></ul><ul><li>The seekp() and tellp() functions allow you to set and examine the put pointer. </li></ul>
  10. 10. seekg() function : <ul><li>With one argument : </li></ul><ul><li>seekg(k) where k is absolute position from the beginning. The start of the file is byte 0 </li></ul>Begin File End k bytes ^ File pointer The seekg() function with one argument
  11. 11. seekg() function : <ul><li>With two arguments : </li></ul><ul><ul><li>the first argument represents an offset from a particular location in the file. </li></ul></ul><ul><ul><li>the second specifies the location from which the offset is measured. </li></ul></ul>Begin End ^ Offset from Begin The seekg() function with two argument
  12. 12. seekg() function : <ul><li>With two arguments : </li></ul>Begin End ^ Offset from Begin The seekg() function with two argument ^ ^ Offset from end Offset from current position
  • ShefaIdrees

    Jul. 18, 2017
  • madhurkant

    Dec. 19, 2016
  • gigigeorge351

    Jun. 25, 2014
  • muhammadyousafch

    Dec. 5, 2013

Vistas

Total de vistas

15.343

En Slideshare

0

De embebidos

0

Número de embebidos

37

Acciones

Descargas

547

Compartidos

0

Comentarios

0

Me gusta

4

×