Since there is no real insert, I guess the best you could do would be to create a new file for the current entry, append the previous file and do the appropriate deleting and renaming.
Rick
>I would like to append data to my LOG.TXT file at the begining of the file not at the end. Is there a way of doing that with low level functions? The following is the function I have for now but this let me add data at the bottom of the log file.
>
>Any suggestions on how to add data at the begining of the file? Thank you in advance.
>
>FUNCTION writeit()
>PARAMETER cdt
>cdt = cdt + TIME() + " " + DTOC(DATE())
>IF FILE('log.txt') && Does file exist?
>nlogfile = FOPEN('log.txt',12) && If so, open read-write
>ELSE
>nlogfile = FCREATE('log.txt') && If not, create it
>ENDIF
>IF nlogfile < 0 && Check for error opening file
>WAIT 'Cannot open or create output file' WINDOW NOWAIT
>ELSE && If no error, write to file
>FSEEK(nlogfile,0,2)
>FPUTS(nlogfile,cdt)
>FCLOSE(nlogfile)
>ENDIF
>RETURN
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement