1 / 13

EOF & Fseek ()

EOF & Fseek (). Group 7 Haslyn Martin Angelica Silva Catherine Alviz. Outline. Diagram Definition Functions Examples Summary. Diagram. Create file. Write to file. Read file. Seek file element. Print element. Definition.

wolfe
Télécharger la présentation

EOF & Fseek ()

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EOF & Fseek() Group 7 Haslyn Martin Angelica Silva Catherine Alviz

  2. Outline • Diagram • Definition • Functions • Examples • Summary

  3. Diagram Create file Write to file Read file Seek file element Print element

  4. Definition • End of file (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream. • fseek() sets the file position indicator associated with file stream according to the values of offset and origin and supports random access I/O operations.

  5. Functions • fgets(): The function fgets() reads up to num - 1 characters from the given file stream and dumps them into str. • fopen(): The fopen() function opens a file indicated by fname and returns a stream associated with that file. • fread(), reads count number of objects size bytes in length from the stream pointed to by file stream and stores them in the array pointed to by buf.

  6. Functions • feof(): The function feof() returns a nonzero value if the end of the given file stream has been reached. • fprintf(): The fprintf() function sends information (the arguments) according to the specified format to the file indicated by stream. • fwrite(), writes count number of objects, each object size bytes in length, to the stream pointed to by file stream from the character array pointed to by buf

  7. Example 1

  8. Example 1

  9. Example 2

  10. Example 2

  11. Example 3

  12. Example 3

  13. Summary The EOF and the fseek functions are designed to open, write, and print a user specified text file to read and display it line by line until the end of file is reached.

More Related