Discussing the article: "From Basic to Intermediate: Random Access to Files (I)"

 

Check out the new article: From Basic to Intermediate: Random Access to Files (I).

In today's article, we will explore random access to file contents for the first time. This applies to both writing and reading information stored in a file. However, since the topic is too broad to cover in a single article, we will limit ourselves here to an introduction to random access.

In the previous article, From Basic to Intermediate: FileSave and FileLoad, we introduced the FileLoad and FileSave library functions. Although many developers consider them somewhat limited because certain operations can be cumbersome, they are very useful when it comes to generating log files. For those unfamiliar with them, log files help us understand how code behaves in specific scenarios and are an extremely useful tool for any developer.

Even so, the FileSave and FileLoad functions are mainly aimed at implementations in which access to file data is sequential. This is a consequence of how these functions operate. Developers often need random access to a file, although FileLoad and FileSave can provide it only indirectly by loading the entire file into memory and saving it again.

Therefore, although random access can be emulated, it is not actually performed in the usual way. The goal of true random access is to load only the required portions of a file in small blocks. Although this may seem unnecessary now that memory is inexpensive enough to hold large files, it can be very useful in many other scenarios where the goal is to split or fragment the file in a specific way.

From Basic to Intermediate: Random Access (I)

Author: CODE X


Author: CODE X