Thread: RE: [Dev-C++] pipe to a file?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Igor P. <igo...@po...> - 2003-12-04 10:23:45
|
Hi, Answer to your question depends on how the aplication you mentioned sends alarms to the file. If it sends them to standart output and they are redirected to the file then you can write a program that reads standart input and for each line of input it does what you want to do (something like: <program_that_sends_alarms> | <your_alarm_filter> ). But most probably the situation is as follows: the program writes alarms directly to the file - then your easiest option is to write a program that opens this file for reading and periodically checks if something has changed in that file. If you know unix then command "tail -f" may give you an idea what i am talking about. It is the easiest solution and you can write an ordinary program that does that. As far as I know there is no such thing on windows as fifo special files that you know from unix. But if you want to do it the hard way you can search for infromation on how to write a filesystem filter driver - then you can intercept all the write operations to a file, but that is totally different story. Regards Igor Pierscinski > -----Original Message----- > From: Christian Sch=E4fer [mailto:ca...@kr...] > Sent: Thursday, December 04, 2003 8:42 AM > To: Dev...@li... > Subject: [Dev-C++] pipe to a file? >=20 >=20 > hi Dev-cpp-users, >=20 > I have a difficult problem here and an idea how to solve it, which I > am not really sure of if it would be possible.. >=20 > I have an application running that sends out alarmings. these alarms > are appended to a plain-text-file. one alarm =3D=3D one line. >=20 > I want to write an application that puts itself where the file is, and > recieves the appendings, writes them to another file and several other > things. >=20 > I think this can maybe done by pipes, but I do not know how to do it. > an alarm should be treated like an event, when it occures something > has to be done about it (ring a bell :). >=20 > of course this application would need to run as a service. > I also need some hints or tutorials here, to write a service. > (I usually program for unix systems but that's really different..) >=20 > but first I need to get this append-problem solved. >=20 > thanks in advance! >=20 > =20 > gruss > /Christian mailto:ca...@kr... >=20 > --=20 > I propose that the following character sequence for joke markers: >=20 > :-) > 19-Sep-82 11:44 Scott E Fahlman >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by OSDN's Audience Survey. > Help shape OSDN's sites and tell us what you think. Take this > five minute survey and you could win a $250 Gift Certificate. > http://www.wrgsurveys.com/2003/osdntech03.php?site=3D8 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |
|
From: Per W. <pw...@ia...> - 2003-12-04 13:05:17
|
To my knowledge it is possible to implement fifo files in NT too. However, you would then need the IFS SDK (I think that was the correct name), and M$ charges a lot for this SDK. The SDK is targeted at implementation of own file systems, file reparse points etc. In theory, you can do these things with the normal DDK - Device Driver ToolKit - but you will miss sample code and needed include files so you would then need to google around for PD code. The simplest solution is to implement a tail program that prenumerates to changes. Then you don't have to constantly poll the size of the file to detect new alarms. /Per W On Thu, 4 Dec 2003, Igor Pierscinski wrote: > Hi, > > Answer to your question depends on how the aplication > you mentioned sends alarms to the file. If it sends > them to standart output and they are redirected to the file > then you can write a program that reads standart input > and for each line of input it does what you want to do > (something like: <program_that_sends_alarms> | <your_alarm_filter> ). > But most probably the situation is as follows: the program > writes alarms directly to the file - then your easiest option > is to write a program that opens this file for reading and > periodically checks if something has changed in that file. > If you know unix then command "tail -f" may give you an > idea what i am talking about. It is the easiest solution and > you can write an ordinary program that does that. > As far as I know there is no such thing on windows as fifo > special files that you know from unix. > But if you want to do it the hard way you can search for > infromation on how to write a filesystem filter driver - then > you can intercept all the write operations to a file, but that > is totally different story. > > Regards > > Igor Pierscinski > > > -----Original Message----- > > From: Christian Sch=E4fer [mailto:ca...@kr...] > > Sent: Thursday, December 04, 2003 8:42 AM > > To: Dev...@li... > > Subject: [Dev-C++] pipe to a file? > > > > > > hi Dev-cpp-users, > > > > I have a difficult problem here and an idea how to solve it, which I > > am not really sure of if it would be possible.. > > > > I have an application running that sends out alarmings. these alarms > > are appended to a plain-text-file. one alarm =3D=3D one line. > > > > I want to write an application that puts itself where the file is, and > > recieves the appendings, writes them to another file and several other > > things. > > > > I think this can maybe done by pipes, but I do not know how to do it. > > an alarm should be treated like an event, when it occures something > > has to be done about it (ring a bell :). > > > > of course this application would need to run as a service. > > I also need some hints or tutorials here, to write a service. > > (I usually program for unix systems but that's really different..) > > > > but first I need to get this append-problem solved. > > > > thanks in advance! > > > > > > gruss > > /Christian mailto:ca...@kr... > > > > -- > > I propose that the following character sequence for joke markers: > > > > :-) > > 19-Sep-82 11:44 Scott E Fahlman > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by OSDN's Audience Survey. > > Help shape OSDN's sites and tell us what you think. Take this > > five minute survey and you could win a $250 Gift Certificate. > > http://www.wrgsurveys.com/2003/osdntech03.php?site=3D8 > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > ------------------------------------------------------- > This S |
|
From: <ca...@kr...> - 2003-12-04 18:24:35
|
hi all,
unfortunately I have no control over the alarming application, also
the append is directed to the file directly and not to stdout..
so lets summarize:
either I have to write a program constantly checking the file on
changes or I have to use nt fifo files which it will be hard to find
out about.
I'd prefer the second one, although this could take some time..
any hints or maybe a better solution.
gruss
/Christian mailto:ca...@kr...
--
I propose that the following character sequence for joke markers:
:-)
19-Sep-82 11:44 Scott E Fahlman
|
|
From: Per W. <pw...@ia...> - 2003-12-04 18:49:35
|
See the function FindFirstChangeNotification(). I tallows you to wait for any changes made to a directory. Then you don't have to poll the file constantly, but will instead be informed when something has changed. /Per W On Thu, 4 Dec 2003, Christian Sch=E4fer wrote: > hi all, > > unfortunately I have no control over the alarming application, also > the append is directed to the file directly and not to stdout.. > > so lets summarize: > either I have to write a program constantly checking the file on > changes or I have to use nt fifo files which it will be hard to find > out about. > > I'd prefer the second one, although this could take some time.. > any hints or maybe a better solution. > > > > gruss > /Christian mailto:ca...@kr... > > -- > I propose that the following character sequence for joke markers: > > :-) > 19-Sep-82 11:44 Scott E Fahlman > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |