2. 2Rushdi Shams, Dept of CSE, KUET, Bangladesh
Different operations on filesDifferent operations on files
1.1. Creation of a new fileCreation of a new file
2.2. Opening an existing fileOpening an existing file
3.3. Reading from a fileReading from a file
4.4. Writing to a fileWriting to a file
5.5. Moving to a specific location in a file (seeking)Moving to a specific location in a file (seeking)
6.6. Closing a fileClosing a file
3. 3Rushdi Shams, Dept of CSE, KUET, Bangladesh
Various file concepts from oneVarious file concepts from one
programprogram
Now, we will see various concepts on files fromNow, we will see various concepts on files from
just one program.just one program.
9. 9Rushdi Shams, Dept of CSE, KUET, Bangladesh
Error opening file??Error opening file??
While opening the file in “r” mode, this mayWhile opening the file in “r” mode, this may
happen because the file being opened may nothappen because the file being opened may not
be present on the disk at allbe present on the disk at all
11. 11Rushdi Shams, Dept of CSE, KUET, Bangladesh
Now we will write a program that countsNow we will write a program that counts
Character, newlines, blank spaces and tabs fromCharacter, newlines, blank spaces and tabs from
a filea file