how to "push" a word (string) to a given position in a file without overwriting the text (programming c) -
i wonder how can update existing file, , add word in given position.
so let file looks like:
this first line in file
and want add word "is " in position 6 file like:
this first line in file
what best method achieve that? should fopen mode? assume file big copy memory, or create temporary clone
thanks!
there no magic "insert in middle" open mode. have yourself.
if can't fit in memory, , don't want/can't create temporary, can rewrite "from bottom". (i.e. read last "block", write shifted amount want, repeat.)
Comments
Post a Comment