1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C programs and a better way to get around on the screen.

Discussion in 'C' started by James P. Devaney, Jul 8, 2009.

Thread Status:
Not open for further replies.
  1. James P. Devaney

    James P. Devaney New Member

    Jul 8, 2009
    Likes Received:
    Trophy Points:
    I am trying to do some programming. I'm trying to use C. Half way through a book I gave up trying to learn C++. Now I have C++ but it does take C. I have Borland C++ ver. 4.52. What about the Bloodshed code? It seems to have changed in the past few months. There is nobody there for general questions.
    Two questions:
    Here's a sample of my code:
    #include <graphics.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <conio.h>
    #include <time.h>
    #include <dos.h>
    void light1 (void);
    void r01 ( void );
    int main(void) {
    /* request auto detection */
        int gdriver = DETECT, gmode, errorcode;
        int midx, midy;
        /* initialize graphics, local variables */
        initgraph(&gdriver, &gmode, "");
        /* read result of initialization */
        errorcode = graphresult();
        if (errorcode != grOk)
        /* an error occurred */
            printf("Graphics error: %s\n", grapherrormsg(errorcode));
                    printf("Press any key to halt:");
            exit(1); /* terminate with an error code */
    /* Make a box */
        setcolor(6); /* brown */
    /*    baselin1(); */ 
        sound1(); /* Has to come after setrvlr1(); or (?) baselin1(); */
    void r01 ( void ) {
        int i = 0;
        for (i=1; i<478; i++) {
            setcolor (13);
            line ( 636, 5 + i, 636, i);
            setcolor (11);
            line ( 635, i + 1, 635, i + 1);
        setcolor (13);
    There is code there that you probably don't like. The "request auto detection " and the initgraph stuff. But see the last stuff so lines can be drawn like "line ( 636, 5 + i, 636, i);". I'm drawing lines the old way. Is there a new way without that stuff?

    Secondly, I know from some years as tech support, fifteen years ago, that a program "The Mail Order Wizard" could be run in two ways. The people had to be careful about their drive space, not wasting it. The Wizard used to be a DOS program and could be brought up on the C:\ or D:\ or E:\ etc. by Wizard C or D or E, Etc. The program could be written in Assembler or C++.

    How do I send that letter in? I would like to know that.

    Thank you very much for your help.

    Jim Devaney
    Last edited by a moderator: Jul 9, 2009
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    May 5, 2009
    Likes Received:
    Trophy Points:
    Orissa, INDIA
    Home Page:
Thread Status:
Not open for further replies.

Share This Page