473,382 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

pop line from file

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
Feb 15 '06 #1
4 3401
Try open.readline()
help(open)

....

Feb 15 '06 #2
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
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Feb 15 '06 #3
Sybren Stuvel wrote:
If you're working on a UNIX platform, you could use FIFO pipes, see
'mkfifo'.


named pipes exist on windows, see win32pipe.CreateNamedPipe

Feb 15 '06 #4
i am unix platform, now searching for the mkfifo topics.
thank you all.
Feb 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tor Erik Sønvisen | last post by:
Hi How can I read the first line of a file and then delete this line, so that line 2 is line 1 on next read? regards
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
2
by: Eric Lilja | last post by:
Hello, I'm writing a simple program that upon start-up needs to open a text file and read a value on the last line. Then all other accesses to the file will be writes (at the end of it). I'm having...
8
by: Frost | last post by:
Hi All, I am a newbie i have written a c program on unix for line by line comparison for two files now could some one help on how i could do word by word comparison in case both lines have the...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
6
by: magix | last post by:
Hi, when I read entries in file i.e text file, how can I determine the first line and the last line ? I know the first line of entry can be filtered using counter, but how about the last line...
13
by: programming | last post by:
how do i delete from a text file 1 of the following lines: jon|scott adam|smith <--delete paul|clark say i would like to delete the middle line of this txt, in member.txt what php code or...
0
by: 7stud | last post by:
Hi, 1) Does this make any sense: """ Thus, the loop: for line in f: iterates on each line of the file. Due to buffering issues,
4
by: lilyumestar | last post by:
I have project I have to do for class. We have to write 4 different .java files. Project2.java HouseGUI.java House.java HouseSorting.java I already finish House.java and I need to work on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.