home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 187 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  64 lines

  1. Path: luck.shnet.org!postmaster
  2. Newsgroups: comp.sys.amiga.programmer
  3. References: <Pine.HPP.3.91-941213.960103232026.2289A-100000@pahang.dur.ac.uk>
  4. From: "Christian Pekeler" <pekeler@luck.shnet.org>
  5. Date: Thu, 04 Jan 96 10:27:41 +0100
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=iso-8859-1
  8. Content-Transfer-Encoding: 8bit
  9. Subject: Re: Amiga equiv of conio.h
  10. Message-ID: <29790985@luck.shnet.org>
  11.  
  12. Nick Pratt:
  13. > Ok, Ive been programming on a PC for some company, and Ive relied quite 
  14. > heavily on the functions in conio.h(Turbo C++, V3.0), and I was
  15. > wondering if anyone has any equivalent amiga functions for this library,
  16. > such as gotoxy(x,y), clreol(x,y) (clear to end of line from pt x,y) etc.
  17.  
  18. This dirty hack worked for me in g++, maybe it will help you as
  19. a basis for other funktions of conio...
  20.  
  21. my_conio.h----------------------CUT----------------------------------
  22. // my conio.h, Christian Pekeler, 23.5.95
  23.  
  24. #ifndef _my_conio_h
  25. #define _my_conio_h
  26.  
  27. void    clreol();
  28. void    clrscr();
  29. void    gotoxy(int x, int y);
  30. char    getch();
  31. char    getche();
  32. int    kbhit();
  33. int    putch(char c);
  34.  
  35. #endif /* _my_conio_h */
  36. --------------------------------CUT----------------------------------
  37.  
  38. my_conio.cpp--------------------CUT----------------------------------
  39. // my conio.cpp, Christian Pekeler, 23.5.95
  40.  
  41. #include <clib/dos_protos.h>
  42. #include <iostream.h>
  43. #include "my_conio.h"
  44.  
  45. #define scon    SetMode(Output(), 0)
  46. #define sraw    SetMode(Output(), 1)
  47.  
  48. void    clreol()        {cout<<""; return;}
  49. void    clrscr()        {cout<<"H"<<""; return;}
  50. void    gotoxy(int x, int y)    {cout<<""<<y<<";"<<x<<"H"; return;}
  51. char    getch()            {sraw; char c; cin.get(c); scon; return c;}
  52. char    getche()        {sraw; char c; cin.get(c); cout<<c; scon; return c;}
  53. int    kbhit()            {sraw; char c; cin.get(c); scon; return 1;}
  54. int    putch(char c)        {cout<<c; return 1;}
  55.  
  56. #undef scon
  57. #undef sraw
  58. --------------------------------CUT----------------------------------
  59.  
  60. Hope the ESC-Codes make it through. Sorry, but can't remember where
  61. I've looked them up.
  62.  
  63.  Christian
  64.