Line replace
DarkBlue
nomail at nixmail.com
Sun Jan 1 09:37:25 EST 2006
> OK, why don't you store those changing lines in the database?
>
> Can you arrange for those changeable lines to be fixed length, i.e.
> by padding with spaces or something? If you can, then you could just
> overwrite them in place. Use flock or fcntl (Un*x) or the comparable
> Windows locking primitives to make sure other processes don't update
> the file simultaneously.
hmm , the line is actually being read from a database
and now needs to be written into a file replacing
the line after the marker...
the line contains only an ip address
pseudocode is like this:
get newlinetext from database # this is ok done with kinterbas
preferably check if file not in use by other process
open file and find desired marker
go to line after marker and replace that one with newlinetext
close the file
Should be easy, but I am suffering from New Year writer's block..
Nx
More information about the Python-list
mailing list