Path in graphics in C
up vote
0
down vote
favorite
I had been using graphics.h in my program for a while. I was facing problem in the path but I later resolved it. Now, I typed the wrong path in the initigraph()
function but the program still worked. How is it possible?
Code1:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="vyfm";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
Code 2:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="C:\TC\BGI";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
turbo-c bgi
add a comment |
up vote
0
down vote
favorite
I had been using graphics.h in my program for a while. I was facing problem in the path but I later resolved it. Now, I typed the wrong path in the initigraph()
function but the program still worked. How is it possible?
Code1:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="vyfm";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
Code 2:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="C:\TC\BGI";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
turbo-c bgi
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)
– paulsm4
Nov 17 at 6:08
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
2
@KeshavSarafC:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else...graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI
– Spektre
Nov 17 at 8:58
2
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I had been using graphics.h in my program for a while. I was facing problem in the path but I later resolved it. Now, I typed the wrong path in the initigraph()
function but the program still worked. How is it possible?
Code1:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="vyfm";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
Code 2:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="C:\TC\BGI";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
turbo-c bgi
I had been using graphics.h in my program for a while. I was facing problem in the path but I later resolved it. Now, I typed the wrong path in the initigraph()
function but the program still worked. How is it possible?
Code1:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="vyfm";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
Code 2:
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char a ="C:\TC\BGI";
int gd = DETECT, gm;
initgraph(&gd, &gm, a);
line(100,100, 200, 200);
getch();
closegraph();
return 0;
}
turbo-c bgi
turbo-c bgi
edited Nov 17 at 8:55
Spektre
28.7k645200
28.7k645200
asked Nov 17 at 6:06
Keshav Saraf
248
248
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)
– paulsm4
Nov 17 at 6:08
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
2
@KeshavSarafC:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else...graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI
– Spektre
Nov 17 at 8:58
2
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24
add a comment |
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)
– paulsm4
Nov 17 at 6:08
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
2
@KeshavSarafC:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else...graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI
– Spektre
Nov 17 at 8:58
2
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:
initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)– paulsm4
Nov 17 at 6:08
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:
initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)– paulsm4
Nov 17 at 6:08
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
2
2
@KeshavSaraf
C:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else... graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI– Spektre
Nov 17 at 8:58
@KeshavSaraf
C:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else... graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI– Spektre
Nov 17 at 8:58
2
2
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
If you say that you are using codeblocks, be careful about compiling the code then run it. If you just use the "run" command in codeblocks it will just run your last exe, even if you current file is modified. The exe will be modified when you successfully compile your code. In this case your code should compile, but I think you missed this step.
New contributor
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If you say that you are using codeblocks, be careful about compiling the code then run it. If you just use the "run" command in codeblocks it will just run your last exe, even if you current file is modified. The exe will be modified when you successfully compile your code. In this case your code should compile, but I think you missed this step.
New contributor
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
add a comment |
up vote
0
down vote
If you say that you are using codeblocks, be careful about compiling the code then run it. If you just use the "run" command in codeblocks it will just run your last exe, even if you current file is modified. The exe will be modified when you successfully compile your code. In this case your code should compile, but I think you missed this step.
New contributor
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
add a comment |
up vote
0
down vote
up vote
0
down vote
If you say that you are using codeblocks, be careful about compiling the code then run it. If you just use the "run" command in codeblocks it will just run your last exe, even if you current file is modified. The exe will be modified when you successfully compile your code. In this case your code should compile, but I think you missed this step.
New contributor
If you say that you are using codeblocks, be careful about compiling the code then run it. If you just use the "run" command in codeblocks it will just run your last exe, even if you current file is modified. The exe will be modified when you successfully compile your code. In this case your code should compile, but I think you missed this step.
New contributor
New contributor
answered Nov 17 at 6:13
RpdStrike
11
11
New contributor
New contributor
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
add a comment |
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
I always use build and run option.
– Keshav Saraf
Nov 17 at 6:15
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348687%2fpath-in-graphics-in-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
My GOSH!!! This is an ANCIENT Turbo C API. The C++ language (to say nothing of computing in general) has changed a lot since then... As to your question:
initgraph()
initializes the graphics system, and loads some runtime files from the BG (Borland Graphics) directory. I guess your exe just didn't need any of those runtime files ;)– paulsm4
Nov 17 at 6:08
I am using codeblocks
– Keshav Saraf
Nov 17 at 6:09
But how is it posiible that the initgraph function doesn't requires any directory?
– Keshav Saraf
Nov 17 at 6:12
2
@KeshavSaraf
C:\TC\BGI
is clearly Turbo C, ... BGI works only under MS-DOS so if you're really have CodeBlocks what BGI an OS you got or targeting? That might answer your question as different version of BGI might handle the parameters differently. IIRC WinBGI has different header so you have something else...graphics.h
is meaningless as almost all gfx engine has such file ... your code is clearly ancient BGI– Spektre
Nov 17 at 8:58
2
You asked a similar question here. SAD AND UNFORTUNATE FACT: even if your program does something "wrong" ... you WON'T (necessarily) get a compile error, and it MIGHT NOT even fail at runtime (at least not at first). It might "appear" to work. Those are the WORST kinds of bugs - the ones your customer finds, before you do :( Always beware "undefined behavior".
– paulsm4
Nov 17 at 22:24