Page 1 of 1

Posted: Fri Jun 28, 2002 5:03 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.

I need to append information to a file, ie: add a line at the end of the file to manage something like a log file.

I do not find the possibility to do this without reading the whole file in PureBasic. Maybe I am wrong ?

Does one have experienced this kind of feature with PB or does it exist something using Win API ?

Otherwise I will post this later as a feature request !

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Fri Jun 28, 2002 5:17 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

Just use the following combo:

OpenFile(x,xxxx$)
FileSeek(Lof())
; Now you're at the end of the file



Fred - AlphaSND

Posted: Fri Jun 28, 2002 5:19 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.

Nice and short ! Thnx

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Fri Jun 28, 2002 5:21 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

I think this has been recently discussed here regarding INI or preference files, and the conclusion AFAIK was: you must read and write the whole file.

Bye,

El_Choni

Posted: Fri Jun 28, 2002 6:58 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> I need to append information to a file, ie: add a line at the end of the file
> to manage something like a log file.

Here's an "AddLine" procedure that I posted last year. The good thing about it
is that you don't need to Open/Close any files to accomplish the deed, ie. you
just call the procedure like this: AddLine(filename$,line$).

viewtopic.php?t=336


PB - Registered PureBasic Coder

Edited by - PB on 28 June 2002 20:02:40

Posted: Sat Jun 29, 2002 6:44 am
by BackupUser
Restored from previous forum. Originally posted by fweil.

I checked Fred response and PB snippet, and my conclusion is that fileseek allows to have an close-to-non-filesize-dependent response time !

This was my concern to have logfiles processing with the possibility to let logfiles growing to a large size (ie : several MB) with a short time to process each log add.

I measured it on my PC and found reasonable results even on > 32MB file size (< half a ms each log for this test with the file growing from 0 to 32MB).

It sounds good to me.

Thnx2all

Francois Weil
14, rue Douer
F64100 Bayonne