| | |
read lines from file which gets updated at same time
![]() |
•
•
Join Date: May 2008
Posts: 538
Reputation:
Solved Threads: 86
Under windows, getting the file open by two programs is a matter of using file sharing modes. The 'reader' would commonly "deny none" the 'updater' would commonly 'deny write'.
The only real concern I have is whether or not the two programs need to interact at all. How does the reader know when all of the data has been read, or does it keep trying to read in case the updater puts more data into the file?
If the second case:
How does the reader know when the data is complete?
How does the reader know that it is 'done'?
The only real concern I have is whether or not the two programs need to interact at all. How does the reader know when all of the data has been read, or does it keep trying to read in case the updater puts more data into the file?
If the second case:
How does the reader know when the data is complete?
How does the reader know that it is 'done'?
•
•
Join Date: May 2008
Posts: 538
Reputation:
Solved Threads: 86
Sounds fairly straightforward then.
Make sure you plan that the reader might be able to get a 'partial' record from the updater. It is possible that the processor might swap from one app to the other before the record is completely written.
For file sharing, look at "FileShare Enumeration" for .Net in MSDN
Make sure you plan that the reader might be able to get a 'partial' record from the updater. It is possible that the processor might swap from one app to the other before the record is completely written.
For file sharing, look at "FileShare Enumeration" for .Net in MSDN
•
•
Join Date: May 2008
Posts: 538
Reputation:
Solved Threads: 86
If you're planning to implement this in C, you're posting in the wrong forum. (I personally use the forum you posted your message into as a guide into how to answer the question.)
I'd have to go back and see what fgets() would do if it reached the 'end of file' without seeing a '\n'. I think it will still fetch the data from the file. As far as the reader program is concerned, the file does not have (and will not have) any more data. The libraray is not aware that more data will be written. You might even have to call some form of reset (to clear the EOF / error status) on the file in the reader to get it to read more data afterward.
I'd have to go back and see what fgets() would do if it reached the 'end of file' without seeing a '\n'. I think it will still fetch the data from the file. As far as the reader program is concerned, the file does not have (and will not have) any more data. The libraray is not aware that more data will be written. You might even have to call some form of reset (to clear the EOF / error status) on the file in the reader to get it to read more data afterward.
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Send data on a serial port (C++)
- how do I have txt file be read by the compiler? (C++)
- Aurora ABI Problem and Trojan Viruses (Viruses, Spyware and other Nasties)
- Login trouble - Still have trouble after trying really hard to figure it out myself! (Viruses, Spyware and other Nasties)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
- Browser's File Interpreters (Computer Science)
Other Threads in the C Forum
- Previous Thread: Text Extraction From Image
- Next Thread: how to add program to start up in C
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o include incrementoperators input interest kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue mysql number odf open openwebfoundation owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling segmentationfault send sequential shape socket socketprograming stack standard string systemcall turboc unix user voidmain() wab win32api windows.h






