473,382 Members | 1,526 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.

reading a text file at certain timeouts

i have a text file lets say in this format

abc abs ajfhg agjfh
fhs ghg jhgjs fjhg
dj djk djghd dkfdf
....
....
......

i want to read the first line at certain time for eg : at 10clk
and the next time when i am reading the text file for eg a timeout of
10 min (@ 10:10) i want to read only the second line skipping the
first line
and at 10:20 (again after timeout of 10 min) i wanna read only the 3rd
line skipping 1st and 2nd lines
and so on...

this 10 min time is not fixed..it varies for line to line....i wrote
this time for convenience...

i tried with a counter such that when i read the first line i am
incrementing the counter and comparing when i am read the next
time...somehow i am missing something, i am not getting the proper
result...

thanks for any help..
Jun 27 '08 #1
2 1952
fr*********@googlemail.com wrote:
i have a text file lets say in this format

abc abs ajfhg agjfh
fhs ghg jhgjs fjhg
dj djk djghd dkfdf
...
...
.....

i want to read the first line at certain time for eg : at 10clk
and the next time when i am reading the text file for eg a timeout of
10 min (@ 10:10) i want to read only the second line skipping the
first line
and at 10:20 (again after timeout of 10 min) i wanna read only the 3rd
line skipping 1st and 2nd lines
and so on...

this 10 min time is not fixed..it varies for line to line....i wrote
this time for convenience...

i tried with a counter such that when i read the first line i am
incrementing the counter and comparing when i am read the next
time...somehow i am missing something, i am not getting the proper
result...

thanks for any help..
This is more a programming question than a C++ question because the answer
would pretty much be the same in any language you used.

You haven't stated what you want to do with the line, nor what you want to
do while you are not reading the line so it's hard to give an exact
algorithm.

It might be something like (in pseudo code):

store time into starttime
count = 1
bool continue = true;
while continue
{
if ( ( currenttime - starttime ) count * 10 )
{
read line count in file;
if ( eof )
continue = false;
count++;
}
}

Without stating what you are actually trying to achieve though the algorithm
can't be set in stone

--
Jim Langston
ta*******@rocketmail.com
Jun 27 '08 #2

<fr*********@googlemail.comschreef in bericht
news:f4**********************************@d45g2000 hsc.googlegroups.com...
>i have a text file lets say in this format

abc abs ajfhg agjfh
fhs ghg jhgjs fjhg
dj djk djghd dkfdf
...
...
.....

i want to read the first line at certain time for eg : at 10clk
and the next time when i am reading the text file for eg a timeout of
10 min (@ 10:10) i want to read only the second line skipping the
first line
and at 10:20 (again after timeout of 10 min) i wanna read only the 3rd
line skipping 1st and 2nd lines
and so on...

this 10 min time is not fixed..it varies for line to line....i wrote
this time for convenience...

i tried with a counter such that when i read the first line i am
incrementing the counter and comparing when i am read the next
time...somehow i am missing something, i am not getting the proper
result...

thanks for any help..

this has nothing todo with c++

try another newsgroup

John
Jun 27 '08 #3

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

Similar topics

50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
0
by: Jim dunn | last post by:
HI I am having problems with C# with regards to its compatibility with win32 API methods, I am trying to read from a windows CE comm port using C# and imported methods from coredll.dll, it seems...
0
by: Jim Dunn | last post by:
HI I am having problems with C# with regards to its compatibility with win32 API methods, I am trying to read from a windows CE comm port using C# and imported methods from coredll.dll, it seems...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.