I may have missed the point if so please rephrase your
question and I'll try again, but here's my suggestion...
A notepad document is an ASCII text file. This means the
file comprises lines each of which are terminated with
ASCII characters 10 (0x0a in hex) and 13 (0x0d in hex).
These characters are known as 'Carriage Retrurn' (CR) and
'Line Feed' (LF) respectively, but you probably know this
much already.
As each line is defined as being an alphanumeric string
terminated thus it also means that the file comprises
variables length records. Therefore you can change any
part you wish by manipulating the data in binary mode as
long as you don't add or remove the CR or LF characters.
If you add these characters you will split an existing
record in two. If you overwrite these characters you
join two records together.
For instance, consider the following to be simple text
document view with notepad.
-----------------------------------------------
Dear You,
I am writing to say hello.
Goodbye,
Me
-----------------------------------------------
The same document could be seen as a long binary string, as
follows, (NB: I'm using || to show the CR/LF characters)
Dear You,||I am writing to say hello.||Goodbye,||Me||
If I put a ruler line over this we can see the positions of
all the character (relative to 0).
01234567890123456789012345678901234567890123456789012
Dear You,||I am writing to say hello.||Goodbye,||Me||
The actual file is 53 characters long. Characters 5,6 and
7 read "You". This may be changed to "Joe" using the
following C program.
-----------------------------------------------
#include "stdio.h"
int main(int argc, char* argv[])
{
FILE *fp = fopen("filename.txt", "r+b"

;
fseek(fp, 5, SEEK_SET);
fwrite("Joe", 1, 3, fp);
fclose(fp);
return(0);
}
-----------------------------------------------
Create a file called "filename.txt" containing the sample
document. Then cut and paste the above source code into
your C/C++ IDE and run it. Observe the file will then
change to the following,
-----------------------------------------------
Dear Joe,
I am writing to say hello.
Goodbye,
Me
-----------------------------------------------
As you can see the CR/LF characters in you document
massively restrict your ability to change the content but
it is possible.
Play with this program and change characters 9 & 10 to
spaces and see the affect.
I know this doesn't go as far as answering your question
but hopefully you can pursue the documentation concerning
the C library functions mentioned above and get into the
area youshould be reading up on.