To my experience, when you work with files they are in replace mode. Text editors have both, how do those work?
To my experience, when you work with files they are in replace mode. Text editors have both, how do those work?
There is no such thing as insert mode for file I/O. The way text editors do it is they read the entire file in to a bunch of buffers, you make changes to the text in the buffers, it writes the entire file to disk when you save it. So there's no direct insertion. It reads the whole thing and then writes the whole thing again after you make changes.
If you understand what you're doing, you're not learning anything.
So how complicated will things get if you want to write something like a function that changes a value in a INI file?
Not too bad. Read the whole INI file into memory, change the part you want, and then save the whole thing.
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein