Thread: create a small screen with conio.c

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    7

    create a small screen with conio.c

    hi every body

    I need to creat a editor text like DOS with conio.h I need to know how to creat a

    small screen the exemple is in picture please help me

  2. #2
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    What exactly is your problem? That screen is made by printing characters of different color. Using gotoxy() and cprintf() as well as the color changing functions you should be able to do it.
    Here's a table of cp437 characters which can be helpful: http://www-poleia.lip6.fr/~jfp/inalc.../img/cp437.gif

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    7

    Smile

    hello

    yes but what's the code for create the small screen.?

    thank you very much

  4. #4
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    I'm not telling.

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    7
    OKthanks

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I have a signature that I like.

    If you have specific help that you need with code that you wrote, we can help.

  7. #7
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by MacGyver View Post
    I have a signature that I like.

    If you have specific help that you need with code that you wrote, we can help.
    Yes, but I'm unclear as to how to get the text to display like your signature has. Provide to me the complete program that illustrates that.

    Just kidding of course.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    These are the text mode routines in Borland's early (and now free), compiler:

    clreol - Clears from the cursor to the end of the line
    clrscr - clears the crurrent text window
    deline - deletes the line, lower lines are moved up
    gettext - copies a rect. area of the text screen to an off-screen buffer
    gettextinfo - returns info re: the current text mode, window location, and cursor location
    gotoxy - moves cursor to the specified column and row in the current text window
    highvideo - selects high intensity (bold) video char's.
    insline - inserts a blank line in the current text window at the cursor's location. Other lines are pushed downward.

    lowvideo - selects low intensity video char's.
    movetext - copies text from one part of the screen to another
    normvideo - selects normal intensity video char's
    _setcursortype - sets the cursor's shape
    textattr - sets the attribute (foreground & background colors) for subsequent text output
    textbackground - selects a new background color for text display
    textcolor - selects a new foreground color for text display
    textmode - puts display adaptor into a selected text mode
    wherex - returns the x position of the cursor in the current text window
    wherey - same, but the y position
    window - defines a text window, to hold all future text output.

    Obviously, window is one critical function you'll want.

    You can define a window with this code fragment:
    Code:
    window(10,10,69,14);  /* defines the text window */
    gotoxy(30,2);
    cputs("hello!");
    This bit of code will display four windows on the screen:
    Code:
    #include <conio.h>
    
    int main()  {
       int xsize = 15;
       int ysize = 7;
       int xorg, yorg;
       xorg = yorg = 0;
       int i;
    
       for (i = 0; i < 4; i++)  {
          xorg += 5;
          yorg += 3;
          
          textattr(WHITE + ((i + 1) << 4));
          window(xorg, yorg, xorg+xsize - 1, yorg + ysize - 1);
          clrscr();
          gotoxy(1,1);
          cprintf("This is window number &#37;d", i);
       }
       return 0;
    }
    The above should (if I haven't borked the keyboarding of it) run on early Borland compilers.

    Adak
    Last edited by Adak; 05-17-2007 at 04:40 PM.

  9. #9
    Registered User
    Join Date
    May 2007
    Posts
    7
    thank you very much

    but I can't compile this with DEV-C++ because DEV-C++ don't know gotoxy and window textattr

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    If your compiler doesn't come with conio.h, then you can't use it. Your options are mainly:

    • find a compiler like Borland that supports conio.h
    • find a library that supports these functions (I think the curses library does.)
    • write the functionality using the Win32 API.

  11. #11
    Registered User
    Join Date
    May 2007
    Posts
    7
    I find a library conio.h
    but when I compile I find 2 error
    1- error C2065: 'yorg' : undeclared identifier
    2- error C2065: 'window' : undeclared identifier

  12. #12
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    If it didn't come with the compiler, you can't use it.

    Are you sure you copied all the code properly from the example? The first error sounds like you missed declaring the variable. The second looks like you might have accidentally used window() as a variable instead of a function, but I'm guessing.

  13. #13
    Registered User
    Join Date
    May 2007
    Posts
    7
    yes I copied all the code properly from the example?

    and the library which I give the library which I use

  14. #14
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I see I made an error in my typing on the program for yorg. Ooops!

    I'll fix that with an edit of it.

    You can run Borland's C compiler/IDE in WindowsXP, easily, and it's free from the Borland legacy website. Just download it and fire it up.

    I don't know anything about DEV-C, so I can't help you there.

    Don't you have a windows system to run Borland's compiler and IDE?

    I just looked through your conio.h. It shows a gotoxy() function, but it may be defined in another header, What does your help/man page show for it?

    I'd change to Borland to do this. Is that feasable?


    Adak
    Last edited by Adak; 05-17-2007 at 04:56 PM.

  15. #15
    Registered User
    Join Date
    May 2007
    Posts
    7
    No sorry I don't have I'm a student and in scool we use DEV-C
    thank you adak
    I will try with Borland's C compiler/IDE

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How does MS Excel or Word draw to the screen??
    By Fremontknight1 in forum Windows Programming
    Replies: 2
    Last Post: 07-20-2008, 01:58 PM
  2. console screen (Windows)
    By hakan in forum C++ Programming
    Replies: 1
    Last Post: 03-12-2008, 06:35 AM
  3. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 03:32 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. Output to screen display issues
    By spazjr01 in forum C++ Programming
    Replies: 3
    Last Post: 12-16-2002, 05:45 PM