• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

File I/O operations

Hi Folks! I am having trouble reading a file over the network. The problem is that this file is constantly growing and I wanna read the new(last) lines coming in this file as a result.
The transmission to this file is not constant, sometimes there is a delay until the data comes and gets written to it. Can anyone tell me how to achieve this goal(Code Please)
Eg File at 10:00am looks like
"Hello Brother"
at 10:11am looks like
"Hello Brother"
" How are you Brother";
I have read the first line so this time I wanna capture the last line which is " How are you Brother" only. Hope this lets u understand better.
TIA
0
vesel
Asked:
vesel
  • 2
  • 2
1 Solution
 
ufolk123Commented:
You can have a logic like this.

You can register a notigication by using

FindFirstChangeNotification()

So whenever the file changes you will get a notification , So you would not have to do a polling on the file.
After each time data is written to the file , you open the file , lseek to the end and go backward for a newline.( I assume the writers to file write line by line).

This is a sample flow of operations.
If you have any doubts please get back.

0
 
nietodCommented:
FindFirstChangeNotification() is a windows API function.

vesel, are you using windows?
0
 
veselAuthor Commented:
I am on Win2000 using vc6
Need code folks please help asap

Thx a lot
0
 
nietodCommented:
Then ufolk123's suggestion will work.
0
 
veselAuthor Commented:
Folks i need code to give you 100 points. I know the algo pretty much I wanna see it running.

THx and appreciation.
Vesel
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now