In article <45DC988E.7040800@obry.net>, Pascal Obry writes: > Rob Norris a �crit : >> Currently I'm using text_io which means I have to copy the whole thing >> into memory, insert the line then over write the file with new >> contents. direct_io is not an option (varing string lengths) > > Use Text_IO ok, but why copy all in memory. Just write to a temp file, > delete the original one and rename the temp file. > >> What alternatives should I consider for making insertions faster? >> (NB retrieval of a line needs to be fairly quick as well). > > If you have a lot of modifications to do on the file, then you probably > need to read all the file in memory to have good performances. In this > case, read file in blocks using Stream_IO. Do the changes in memory and > write it back in blocks using Stream_IO. Or use an operating system feature that allows insertions. GNAT Ada 95 on VMS is supposed to emulate DEC Ada features, so that should include the Mixed_Indexed_IO package. There will be more overhead in disk files but for large files it is much better for inserting data in the middle.