I am using C in V6 to create a Forth compiler. I don;t have any interest in Forth as a general purpose language, however I do like it. It's satisfying to create a language from the ground up. I'm interested in it a simple and extensible interpreted language for toying with my PDP-11s, so I'll have some with it in the future.

I have a very basic problem. I am simply using getchar and putchar for console IO, which is convenient indeed. I'm struggling however with how C processes the IO. It seems that when I type at the console, my typing is immediately echoed to my terminal window. When I press backspace the system responds with the character that was deleted, which is fine, as I assume it was from the paper teletype days. However, my code is receiving input and also echoing the output, but nothing appears on the terminal until I press enter, when the system displays the whole line of input, which is essentially a duplicate of what the terminal originally displayed, but with the consolidated edits. My code is reading and echoing the input character by character.

Here's my question. How can I suppress the original C/Unix echo, and get my output to appear immediately? This simple sample code form the C programming manual behaves the same.

int main() {
int c;
while ((c = getchar()) != EOF) {
putchar(c);
}
}

Paul



Paul Riley

Mo: +86 186 8227 8332