1. Re: phantom carriage return bug & Jacques' reply
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA> Aug 14, 1997
- 582 views
At 09:31 14-08-97 -0700, you wrote: >No, it is not in puts(). Look at this variation of my original code. It >happens before the first printf() statement this time. Also there are no >newlines (\n) in any of the statements. I think you missed my point Doug. It is obsious when running the test code from my previous message that puts() and printf() doesn't see the cursor update done by gets() gets() echo it's input at the position where puts() or printf() left the cursor but if you use puts() or printf() after a gets() those two procedures doesn't begin their display where the gets() echo leaved it, but at the position where the last puts() or printf() leaved it. To me it looks like a bug in puts() or printf(). Those two procedures seem to maintain a cursor position independant than that of gets(). gets() echo all character entered on the keyboard including the <ENTER> so when the cursor is on last line of screen, there is a scroll up. And after the return of the function it is at {25,1} Normaly puts() (or printf()) should begin their print there (at {25,1}) but they doesn't because it doesn't see that gets() as update the cursor position. (an scrolled the screen if necessary) Please try the following code. --- clip here ---- include wildcard.e include graphics.e constant KEYBOARD = 0 sequence y position(25,1) printf(1,"enter a string: ",{}) -- after that printf cursor is at {25,17} y = upper(gets(KEYBOARD)) -- after entry there is a scroll up and cursor is at {25,1} while get_key() = -1 do end while -- stop to look at screen and see cursor at {25,1} puts(1,"no line skip") -- the print begin at {25,17} instead of {25,1} -- exactly where printf() left it. puts() didn't see that -- gets() as updated the cursor position. --- clip here ------------------- Jacques Deschenes Baie-Comeau, Quebec Canada desja at globetrotter.qc.ca