Solved

File I/O operations

Posted on 2000-02-17
5
252 Views
Last Modified: 2010-04-02
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
Comment
Question by:vesel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
ufolk123 earned 100 total points
ID: 2533595
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
 
LVL 22

Expert Comment

by:nietod
ID: 2534627
FindFirstChangeNotification() is a windows API function.

vesel, are you using windows?
0
 

Author Comment

by:vesel
ID: 2535836
I am on Win2000 using vc6
Need code folks please help asap

Thx a lot
0
 
LVL 22

Expert Comment

by:nietod
ID: 2535973
Then ufolk123's suggestion will work.
0
 

Author Comment

by:vesel
ID: 2547083
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VS2015 compilation and missing DLLs 9 193
C++ to C# code conversion issue 4 134
thread-safe code in c++ 2 128
learn programming 8 95
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question