Error when running the same program repeatedly in Turbo C using DosBox in Windows7 64bit

1.1k Views Asked by At

I am trying to use Turbo C with DosBox (DosBox 0.74) in my Windows 7 64 bit.

The program works perfectly fine its first run. It compiles successfully without error and also executes flawlessly.

As I try to repeat running the same program, the prorgams seems to generate weird output. Thus the same program which worked perfectly now creates error output though it still compiles successfully.

The following is a program which places a polygon vertices in space depending on the number of vertices. In it's first runs it generates perfectly expected output but as I repeat it it creates completely wrong output. The vertices are placed in completely random locations.

I doubt if it is something related to memory. When I tried using a different emulator also similar error repeated!

Update 1: I just tried with Mac OSX and the same error is repeating.

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>

int main()
{
    int gd=DETECT,gm,count,i,x[100],y[100],r=100;
    initgraph(&gd,&gm,"c:\\tc\\");
    printf("Enter the number of cordinates:");
    scanf("%d",&count);
    printf("Entered count :%d",count);
    for(i=0;i<count;i++)
    {
        x[i]=r*cos(2*3.14*(i+1)/count)+200;
        y[i]=r*sin(2*3.14*(i+1)/count)+200;
        circle(x[i],y[i],5);
    }
    getch();
    return 0;
}
1

There are 1 best solutions below

0
On

change one configuration in the file dosbox-0.74.conf

from core=auto

to core=normal

reopen dosbox again and test your program, it can run accurately for sure! Done!