From: "M. Edward (Ed) Borasky" Date: 2006-11-28T23:31:27+09:00 Subject: Re: how to write file before EOF Timothy Hunter wrote: > Siva Prakasam wrote: >> yes, i want to insert a file without overwriting its existing content. >> i looked for IO:SEEK_CUR and IO:SEEK_SET which will set the >> position.but it overwrites the existing content. how to do that? >> > You'll have to make a new file. Copy the old file contents up to the > point you want to insert the new material, insert the new material, > then copy the remainder of the old file. After the new file is safely > closed, delete the old file. > > It depends on how big the file is and how lazy a programmer you are. For small files and lazy programmers, read the whole file into memory, edit it in memory and write it back out. :) -- M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P) http://borasky-research.blogspot.com/ If God had meant for carrots to be eaten cooked, He would have given rabbits fire.