Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Finding my way around screen and please help with question (http://www.go4expert.com/forums/finding-screen-help-question-t18431/)

James P. Devaney 9Jul2009 01:34

Finding my way around screen and please help with question
 
Hello,
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:

Code: C

#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;
/* 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:");
getch();
exit(1); /* terminate with an error code */
}
/***************************************************************/
/* Make a box */
setbkcolor(LIGHTBLUE);
setcolor(6); /* brown */
/* baselin1(); */
setrvlr1();
light1();
sound1();
getch();
 
void r01 ( void ) {
int i = 0;
for (i=1; i<478; i++) {
setcolor (13);
line ( 636, 5 + i, 636, i);
delay(NUMDEL1);
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? Can you do it? I would like to know that.

Thank you for your time.

Jim Devaney

mayjune 9Jul2009 03:05

Re: Finding my way around screen and please help with question
 
as for your first problem, that is the best way, there are other ways dda line, bresenham line but then you would have to code the whole code for it to draw a line...so this old way is better i would say

ps - don't know why no one notices but we never give any value to gmode variable...
you can replace &gmode with NULL in initgraph(), it works for me in TC, try it in your compiler.
Also instead of DETECT, you can give value 0 too, as its the same thing..

James P. Devaney 9Jul2009 11:07

Re: Finding my way around screen and please help with question
 
Hello,
What about the argument "Wizard C (or D or E)" to tell the PC which drive to try for orders? It's stored in the settings in Assembler or C++. Can you give me an example please?
Thank you.
Jim Devaney

mayjune 9Jul2009 20:48

Re: Finding my way around screen and please help with question
 
i have no idea what this Wizard C is... nor what your question is...


All times are GMT +5.5. The time now is 19:08.