The main() method accepts three arguments: 1) fileName - the path to a file; 2) number - a position in the file; 3) text - the text. Write text to the fileName file starting at the position indicated by number. The write operation must overwrite the old data in the file.
Writing to an existing file
You must be signed in to leave a comment
18 August 2022, 16:38
Interesting, my solution does something different from the CG solution, but it passed anyway. I had taken the conditions to require that if bytes would be written beyond the end of the file, then it must instead be written starting at the end position. However, the CG solution simply checks if the length of the text is greater than the length of the file, and if so, it writes starting at the file end. The difference between the two is that the text length could be much less than the file length, but number could be a position that would still go beyond the end of the file. In this case, the CG solution would not make any changes to the starting write position, but my solution would.
21 October 2019, 09:34
Sorry, I mixed-up tasks.
21 October 2019, 05:06
In requirements is written: Read text from the file, starting from the position indicated by number but validator takes inmethod only form zero position of a file. WTF? )
21 October 2019, 06:04
I don't see this phrase in the requirements.