reading a text file at certain timeouts

F

friend.blah

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..
 
J

Jim Langston

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
 
B

Bruintje Beer

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
 

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
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top