home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
- #include <libraries/dos.h>
-
- #define REC_PKT "RAM:receive.pkt"
- #define REC_ERR "Couldn't open receive packet\n"
-
- struct FileHandle *in=0;
-
- void quit(void) {
- Close(in);
- exit(0);
- }
-
- void main(void) {
- char text[512], buf[512];
- FILE *infile;
- short err=0;
-
- in = (struct FileHandle *)Open("CON:0/0/600/100/Parnet chat receive",MODE_NEWFILE);
- if (!in) quit();
-
- onbreak(quit);
-
- for(;;) {
- chkabort();
- Delay(20);
- chkabort();
-
- err=0;
- if (access(REC_PKT, 4) == 0) {
- if (infile = fopen(REC_PKT, "r")) {
- fgets(buf, sizeof(buf), infile);
- Write(in, buf, strlen(buf));
- fclose(infile);
- infile=0;
- remove(REC_PKT);
- } else err=1;
- };
-
- if (err==1) Write(in, REC_ERR, strlen(REC_ERR));
- }
- }
-
-