130 likes | 300 Views
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.
E N D
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 • 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.
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.
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
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.