Updating a file rondom access

In order for the method to work, first two bytes after the current pointer should tell how many number of bytes after the two bytes should be used for decoding and returning as string.

If a string is not written using write UTF(), there is a high probability that using read UTF() to read the string will throw end of file exception (EOFEexception).

Below example opens file for read only and reads byte at a time.

You need to open the file for write access in order to use set Length() method, otherwise, you will get access denied IO exception.

You can use read UTF() method to read a string encoded in UTF-8 format.

Random Access File provides methods to read and write to files.

To read byte by byte, you can read() method and to read file content into bytes array, you need to pass byte array to read() method.

Search for updating a file rondom access:

updating a file rondom access-62updating a file rondom access-42updating a file rondom access-49

Sequential access is sometimes the only way of accessing the data, for example if it is on a tape.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating a file rondom access”