'TurboC++ graphics.h conflict with conio.h's clreol()
Note: This is TurboC++ so please don't expect STL
I have this simple code that have no other graphics.h functions rather than it's driver's declaration and call. I aim to:
- Print a first string (A longer one)
- Go to the first string's coordinates, clear that string (using
clreol()) - Print the second string which is shorter.
But I rather get this output on print of second string:
Shorter phrase.██████████████████████████████████████████████████████████████████
Here's my code:
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
int gdriver=DETECT, gmode;
void main(){
clrscr();
initgraph(&gdriver,&gmode,"C:\\TURBOC3\\BGI");
printf("Longer phrase than next.");
getch();
gotoxy(1,1);
clreol();
printf("Shorter phrase.");
getch();
}
When I remove the initgraph() function, it works fine, so there might be the problem, but of course I need it.
Solution 1:[1]
Haha - coding problems from stoneage ;). Thanks for this - it activated some nice memories.
My guess would be that you run into problems because you are mixing BGI (graphics) functions and "normal" text output. Try replacing the text output calls with calls to the corresponding BGI functions (if I remember correctly, this was called outtextxy() or something).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mfro |
