SLMT9@cc.usu.edu (07/23/90)
This is a question to all of you C guru's out there. Is there a way to place the CURSOR in a predetermined spot on the screen. Say move it from the bottom right hand corner to the upper left to write in that location again something like the LOCATE command in basic. I would really appriciate any help that anyone can give me. Joshua SLMT9@cc.usu.edu
rick@tmiuv0.uucp (07/26/90)
In article <28589@cc.usu.edu>, SLMT9@cc.usu.edu writes: > This is a question to all of you C guru's out there. Is there a way > to place the CURSOR in a predetermined spot on the screen. Say move it from > the bottom right hand corner to the upper left to write in that location again > something like the LOCATE command in basic. > I would really appriciate any help that anyone can give me. > > Joshua > SLMT9@cc.usu.edu Try this (an ANSI escape sequence): printf("\033[10;21H"); That will place the cursor on line 10, column 21 of the screen. The ANSI escape sequence is defined as: <CSI>y;xH where <CSI> can be either a hexadecimal 9b or an escape character (0x1b or octal 33) followed by a '[' character. The y refers to the row number which must be specified in ASCII characters, and the x is the column number (again in ASCII characters). To make this general purpose, here's a pukey function to do it: void poscursor(short row, short column) { printf("\033[%d;%dH",row,column); } To put the cursor at line 12, column 43: poscursor(12,43); The escape sequences that the console.device understands are in the ROM Kernal Manuals (RKM): Libraries and Devices volume. -- ---------------------------------------------------------------------------- [- O] Rick Stevens ? EMail: uunet!zardoz!tmiuv0!rick -or- uunet!zardoz!xyclone!sysop V CIS: 75006,1355 (75006.1355@compuserve.com from Internet) "I'm tellin' ya, Valiant! Da whole ting stinks like yesterday's diapers!" - Baby Herman in "Who Framed Roger Rabbit" ----------------------------------------------------------------------------
UH2@psuvm.psu.edu (Lee Sailer) (07/27/90)
In article <28589@cc.usu.edu>, SLMT9@cc.usu.edu says: > > This is a question to all of you C guru's out there. Is there a way >to place the CURSOR in a predetermined spot on the screen. Say move it from >the bottom right hand corner to the upper left to write in that location again >something like the LOCATE command in basic. If you think about it, this isn't really a C question, it is an Amiga question. Here's ibe Amigoid way of thinking about it. 1. Do ypou really mean "screen" or do you mean a window on the screen? Most i/o is to and from windows. 2. On the Amiga, TEXT is just a kind of GRAPHICS, so you want to open the graphics library and use its many many functions to do your work for you. 3. Every window w has a drawing structure w->RPort. The drawing and text routines all need it. 4. To move to position x,y (in pixels) try Move(&w->RPort, x, y);. 5. Put text there with Text(&w->RPort, "Hello, world.", 13) ; 6. and so on. Good luck.
fgd3@jc3b21.UUCP (Fabbian G. Dufoe) (07/28/90)
From article <28589@cc.usu.edu>, by SLMT9@cc.usu.edu: > > This is a question to all of you C guru's out there. Is there a way > to place the CURSOR in a predetermined spot on the screen. Say move it from > the bottom right hand corner to the upper left to write in that location again > something like the LOCATE command in basic. > I would really appriciate any help that anyone can give me. > > Joshua > SLMT9@cc.usu.edu There are a number of ways to do it. If you're using Intuition windows you can use the Move() function. If you're using console windows you can emit ANSI escape sequences via printf() or putchar(). The escape sequences are documented in The AmigaDOS Manual's appendix entitled "Console Input and Output on the Amiga" and in Chapter 33 of the Rom Kernel Manual (Console Device). To move the cursor to line 5, column 12 of a console window send the following string to the console window: "0x9b5;12H" --Fabbian Dufoe 350 Ling-A-Mor Terrace South St. Petersburg, Florida 33705 813-823-2350 UUCP: fgd3@jc3b21.UUCP ...uunet!pdn!jc3b21!fgd3
ins624y@monu3.cc.monash.edu.au (mr r. walker) (08/02/90)
This is a shriek for help with C. All I want to do it read in a _single_ character from the keyboard. I have tried getchar() getc() etc etc BUT all of them expect you to press the return key after typing the character --- this is unacceptable as I want to use the keystrokes as commands for a spreadsheet I am writing. HELP!!! Something in vanilla C (I have Aztex 3.6a) would be nice, as this has to run on a BSD Unix system as well. Failing that some Amiga-specific thing would be OK (using CON: or something). Also, is there a yacc port for the Amiga? Compatibility with the BSD yacc is important (BSD running on a Pyramid system). Is there a curses package for the Amiga? Help^20!!! Rod.. ps: we are out of stock of virgin, snow-white goats as the response to the previous post was higher than expected. Gerbils anyone?
david@starsoft.UUCP (Dave Lowrey) (08/14/90)
>In article <3711@monu1.cc.monash.oz> ins624y@monu3.cc.monash.edu.au (mr r. walker) writes: > >This is a shriek for help with C. >All I want to do it read in a _single_ character from the >keyboard. I have tried getchar() getc() etc etc BUT all >of them expect you to press the return key after typing >the character --- this is unacceptable as I want to use >the keystrokes as commands for a spreadsheet I am writing. > > >HELP!!! Something in vanilla C (I have Aztex 3.6a) would be >nice, as this has to run on a BSD Unix system as well. Failing >that some Amiga-specific thing would be OK (using CON: or something). > Your shriek has been heard!!! :-) You need to put your console handler into RAW mode. This is easy with manx. Look up the ioctl() function. It has parms to set and reset raw mode. -- ---------------------------------------------------------------------------- These words be mine. The company doesn't care, because I am the company! :-) Dave Lowrey | david@starsoft or {uhnix1,moray}!starsoft!david Starbound Software Group | Houston, TX | "Dare to be stupid!" -- Weird Al Yankovich