It turns out that backspace isn't always CTRL-H. I don't know what it is on MacOS, but on many UNIX platforms, the default backspace character is CTRL-? (changeable with a terminal setting). This is probably not something you want to specify directly on the UNIX side (I assume that MacOS X behaves like other UNIX variants in this regard); rather, you would want your program to look up the terminal setting for backspace and use that (no, I don't know how to do that in GPC, sorry to say).
--------------------------| John L. Ries | Salford Systems | Phone: (619)543-8880 x107 | or (435)867-8885 | --------------------------|
On Thu, 12 Aug 2010, Tom Schneider wrote:
Here's a puzzle in the from of a program. Regards to all! Tom
program inout (input,output); (* version = 1.01 of inout.p 2010 Aug 12 2010 Aug 12, 1.01: testing on Sun 2010 Aug 12, 1.00: origin on mac
Thomas D. Schneider, Ph.D. National Institutes of Health Gene Regulation and Chromosome Biology Laboratory schneidt@mail.nih.gov http://alum.mit.edu/www/toms (permanent)
Test input string in GPC.
The program reads one character from the user at a time. If the user types the wrong character and wishes to correct it, then they should be able to type control-H (^H) or delete and correct the input. This works with GPC on a Sun computer, but on a Mac OSX (10.6.2) one instead sees '^H' and no backspace occurs.
What can be done at compile time to make backspace work on the Mac?
On a Sun computer:
% inout h the character was h u the character was u b the character was b z the character was z a the character was a b the character was b q the character was q
Backspace (control-H) and delete work as expected.
On a Mac:
% inout a the character was a abcd the character was a abcd^H^H^H^H^H^H^H^H control H or delete gives same^H^H^H the character was a q the character was q
Backspace (control-H) and delete do not work.
*)
var n: char; (* a character from the user *) begin n := ' '; while (n <> 'q') do begin readln(input, n); writeln(output, 'the character was ',n); end; end.