On Fri, Jun 16, 2006 at 11:17:39PM +0200, Otto Moerbeek wrote: > On Fri, 16 Jun 2006, [EMAIL PROTECTED] wrote: > > > So basically, why not mmap() the file, go through the map counting \n > > while replacing them by \0 until you reach end of map. allocate an > > array the size of the counter and have each array entry point to where > > it should in the memory map ? > > I implemented a similar technique in patch(1), minus the '\n' -> '\0' > replacing; patch does not use NUL terminated strings internally. > > But it all depends on which data is being stored: just the lines from > the file, or data based on the chars found in the file. > > -Otto >
Yup, I used this in (function splitfields) where the delimiter was chosen with getopt: http://etudiant.epitech.net/~veins/sort/sort.c