Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!f101.n273.z1.fidonet.org!Peter.M..Perchansky From: Peter.M..Perchansky@f101.n273.z1.fidonet.org (Peter M. Perchansky) Newsgroups: comp.lang.modula2 Subject: TSR Programming Dilema Message-ID: <1044.2690B34D@puddle.fidonet.org> Date: 28 Jun 90 14:50:13 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 1:273/101 - Schizophrenia, Fleetwood PA Lines: 45 Hello: Subject: TSR Program to import an ASCII file into a text editor/word processor. Problem: Our present email system has no import feature; all editing must be done within the email systems editor. Solution: Write a TSR program to perform the following: 1) Activate upon key sequence (alt I). 2) Get file name of ASCII file from user. 3) If valid file perform the following from start of the file to the end of the file: a) Get string of text from file. b) Stuff each character from the input string into the keyboard buffer. Programming Dilema: TSR program fills keyboard buffer (16 characters), and overloads the keyboard buffer. Only the first 16 characters from the file are actually imported. The buffer is not read (cleared) until the TSR becomes inactive, and the calling program takes over once again. Best Guess: Temporarily transfer control to calling program in order for the calling program to read (clear) the keyboard buffer --- then return to the TSR. The sequence should be as follows: 1) Stuff 16 characters or less into the keyboard buffer. 2) Transfer control to calling program until keyboard buffer is read (cleared). 3) Repeat 1 and 2 until no more characters from the text file can be processed. Question: How to implement the "best guess" in Modula-2 or another high level language? -- uucp: uunet!m2xenix!puddle!273!101!Peter.M..Perchansky Internet: Peter.M..Perchansky@f101.n273.z1.fidonet.org