pop line from file

S

Sinan Nalkaya

hello all,
i searched and google long long time but couldnt find any result, i
want pop the first line from file, i dont want to read all file
contents because file is being updated from another proccess. even i
couldnt realize its algorithm, thanks for any suggestion
 
S

Sybren Stuvel

Sinan Nalkaya enlightened us with:
i searched and google long long time but couldnt find any result, i
want pop the first line from file, i dont want to read all file
contents because file is being updated from another proccess.

So basically, what you want is some sort of on-disk FIFO queue, right?
Unless your filesystem supports this, there is no way to do that
programmatically.

Removing the first line of a file without having to rewrite the entire
file, requires the pointer to the beginning of the data of the file to
be altered. Since this pointer usually consists of a block number, it
is impossible to point to the new start, unless all lines in the file
are exactly one block in length. This probably isn't the case.

If you're working on a UNIX platform, you could use FIFO pipes, see
'mkfifo'.

Sybren
 
A

Atanas Banov

Sybren said:
If you're working on a UNIX platform, you could use FIFO pipes, see
'mkfifo'.

named pipes exist on windows, see win32pipe.CreateNamedPipe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,285
Messages
2,571,415
Members
48,107
Latest member
jigyasauniversity

Latest Threads

Top