0 votes
29 views
in Programming Languages & Algorithms by (user.guest)

1 Answer

0 votes
by (user.guest)
 
Best answer

File Operations

Operations on database files can be broadly classified into two categories −

  • Update Operations
  • Retrieval Operations

Update operations change the data values by insertion, deletion, or update. Retrieval operations, on the other hand, do not alter the data but retrieve them after optional conditional filtering.

In both types of operations, selection plays a significant role. Other than creation and deletion of a file, there could be several operations, which can be done on files.

  • Open − A file can be opened in one of the two modes, read mode or write mode. In read mode, the operating system does not allow anyone to alter data. In other words, data is read only. Files opened in read mode can be shared among several entities. Write mode allows data modification. Files opened in write mode can be read but cannot be shared.
  • Locate − Every file has a file pointer, which tells the current position where the data is to be read or written. This pointer can be adjusted accordingly. Using find (seek) operation, it can be moved forward or backward.
  • Read − By default, when files are opened in read mode, the file pointer points to the beginning of the file. There are options where the user can tell the operating system where to locate the file pointer at the time of opening a file. The very next data to the file pointer is read.
  • Write − User can select to open a file in write mode, which enables them to edit its contents. It can be deletion, insertion, or modification. The file pointer can be located at the time of opening or can be dynamically changed if the operating system allows to do so.
  • Close − This is the most important operation from the operating system’s point of view. When a request to close a file is generated, the operating system
  • removes all the locks (if in shared mode),
  • saves the data (if altered) to the secondary storage media, and
  • releases all the buffers and file handlers associated with the file.

The organization of data inside a file plays a major role here. The process to locate the file pointer to a desired record inside a file various based on whether the records are arranged sequentially or clustered.


Please leave a comment below and share with other students in your network if you found this answer helpful. Happy learning!


Related questions

+1 vote
1 answer 1.1k views
+1 vote
1 answer 211 views
+2 votes
1 answer 1.9k views
+1 vote
1 answer 260 views
+1 vote
1 answer 145 views
+1 vote
1 answer 1.1k views
+1 vote
0 answers 100 views
0 votes
1 answer 301 views
0 votes
1 answer 251 views
0 votes
1 answer 228 views
+1 vote
1 answer 712 views
+1 vote
1 answer 165 views
+1 vote
1 answer 276 views
+1 vote
1 answer 144 views
+1 vote
1 answer 577 views
+1 vote
1 answer 726 views
+1 vote
1 answer 945 views
+1 vote
1 answer 86 views
+1 vote
1 answer 131 views
+1 vote
1 answer 251 views
+1 vote
1 answer 1.3k views
–1 vote
1 answer 528 views
+2 votes
1 answer 4.0k views
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...