Use DOSBOX to run TurboC2, TC2 uses the graphics library to draw

Turbo C is a set of C language program development tools developed by the American Borland Company, a large company specializing in software development and research. The company has successively launched a set of Turbo series software, such as Turbo BASIC, Turbo Pascal, and Turbo Prolog, which are very popular among users [1].
Turbo C integrates multiple functions such as program editing, debugging, and linking. In the era of DOS systems, Turbo C was the most widely used PC application development tool, and many application software were developed by Turbo C. With the development of computers and their software, the operating system has developed from DOS to Windows. Most application software under the Windows operating system is no longer developed using Turbo C, but as a very excellent C program development tool, it is still an ideal tool for learning C programming.

TC2 runs in a DOS environment. Install the dos simulator.
Download the official website
https://www.dosbox.com/download.php?main=1
Insert image description here
to install the dos simulator and start the dos simulator. My TC is installed in D:\BuildChanTools\ In the TurboC2 directory, mount the D drive directory with drive letter D

mount d d:\

Insert image description here
Enter the d drive, enter the tc directory, and view the files

d:
cd BUILDC~1\TURBOC2\
dir

When DOS does not load the long file name support program, it only supports the 8.3 file name format, that is, an 8-character file name and a 3-character extension. File names longer than 8 characters will be abbreviated to the first 6 characters + "~ 1 (or other numeric sequence, in case the same file name appears)". For example, AAAAAAAAAA.EXE will be abbreviated to AAAAAA ~ 1.EXE. If there is a file like AAAAAAAB.EXE in the same folder, the similar file will be displayed as AAAAAA~2.EXE,
so buildchantools\turboc2\ is written as BUILDC~1\TURBOC2
and run tc

tc.exe

Insert image description here
Welcome interface
Insert image description here
First set the library file directory, set the include folder, lib folder and tc folder. Set it to the directory corresponding to where you installed TC.
Insert image description here
Save the configuration
Insert image description here
and create a new program.

#include <stdio.h>
#include <graphics.h>
int main(){
    
    
	int gdriver,gmode;
	detectgraph(&gdriver,&gmode);//自动测试硬件
	printf("The graphics driver is %d,mode is %d\n",gdriver,gmode);//打印硬件结果

	getchar();

	initgraph(&gdriver,&gmode,"D:\BUILDC~1\TURBOC2\BGI");//初始化图形,最后一个参数是TC目录下的BGI

	setbkcolor(3);//设置背景色
	setcolor(4);//设置作图色
	bar3d(100,100,300,250,50,1);//画3d长方形
	getchar();

	closegraph();//关闭图形
	return 0;
}

F2 to save

Insert image description here
F9 compile link
Insert image description here
Ctrl+F9 run
Insert image description here
Insert image description here
TC2 and DOSBOX download
https://download.csdn.net/download/m0_60352504/88291039

Guess you like

Origin blog.csdn.net/m0_60352504/article/details/132637987