how to read only modified data from a textfile which is continously changing
-
hi everybody iam working in project in which the textfiles are continously changed ,or some data, is added to it by another application and i have to filter the textfiles and save it to another file and i have to process 56 files at a time and if all are processed continouslty cpu usage comes to 100% so i need to do something so that only the modified data which has addded to the file since last filteration done by my application so how can i do so can anyone guide me to do so thanks original text file format is like 20062511.095525,34444,566,7 and i have to filter it as 11/25/2006,95525,34444,34444,34444,34444,5666,7 pls guide me thanks sourabh
-
hi everybody iam working in project in which the textfiles are continously changed ,or some data, is added to it by another application and i have to filter the textfiles and save it to another file and i have to process 56 files at a time and if all are processed continouslty cpu usage comes to 100% so i need to do something so that only the modified data which has addded to the file since last filteration done by my application so how can i do so can anyone guide me to do so thanks original text file format is like 20062511.095525,34444,566,7 and i have to filter it as 11/25/2006,95525,34444,34444,34444,34444,5666,7 pls guide me thanks sourabh
Seems like a convoluted way of doing things to me. If you have the opportunity to redesign it so that the data is stored in a database of some sort rather than text files then you'll have a much more robust solution. The only way you can detect that a file's contents have actually changed is to read it. The way you can tell if a file has been touched (i.e. written, modified or created) is to inspect the file's creation date or modified date in the file system. At the very least you'll then be able to detect and read only the changed files and not all 56. As an advanced topic you can also be advised of a file's change of status by some system events, but this is I think beyond the scope of this forum. There are articles on The Code Project that discuss this issue if you wish to pursue it.
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)