turbo-c

BGI error, How to Resolve it?

岁酱吖の 提交于 2019-12-01 05:37:23
问题 I want to run a C program that draws a circle. The program is compiling with no error and it is running. After getting the values like radius from the user, I get the error like this : BGI error: Graphics not initialized ( use "initgraph") Even though in my source code I have added this line : int gmode,gdrive=DETECT; initgraph(&gdrive,&gmode,"c\\tc\\bgi"); Still I'm getting error. I'm using Windows and I couldn't figure out where I went wrong. Can anyone help me in this regard? Thanks in

Using a Visual C++ DLL in old Borland C?

只谈情不闲聊 提交于 2019-12-01 04:10:30
I've got to support an old app written in C using the old Borland Compiler (BC 5). Unfortunately the old TCP/IP library that we'd used is starting to show it's age and is having problems with Vista & Win7 machines. I have a new library of functions available for MS Visual C++, and I'd like to use that to make a DLL that would be callable from the Borland C. So, I have 2 issues: 1) how to make a Visual C++ DLL callable from a Borland C program, and 2) if it is callable, how to call the C++ functions from plain old C? Ideally, the entire project should be converted to Visual C, but there a lot

Using a Visual C++ DLL in old Borland C?

痞子三分冷 提交于 2019-12-01 01:53:06
问题 I've got to support an old app written in C using the old Borland Compiler (BC 5). Unfortunately the old TCP/IP library that we'd used is starting to show it's age and is having problems with Vista & Win7 machines. I have a new library of functions available for MS Visual C++, and I'd like to use that to make a DLL that would be callable from the Borland C. So, I have 2 issues: 1) how to make a Visual C++ DLL callable from a Borland C program, and 2) if it is callable, how to call the C++

How does C++ store functions and objects in memory? [duplicate]

别来无恙 提交于 2019-11-29 13:47:10
This question already has an answer here: What will happen when I call a member function on a NULL object pointer? 6 answers Lets say we have a class class A { int x; public: void sayHi() { cout<<"Hi"; } }; int main() { A *a=NULL; a->sayHi(); } The above code will compile on Turbo C (where I tested) and print Hi as output. I was expecting crash because a is NULL . More over if I make sayHi() function virtual, it says Abnormal temination(Segmentation fault in gcc) I know a lot of it is implementation dependent but if anybody could throw some light on any implementation or just give an overview

Cannot run c graphics programs

╄→尐↘猪︶ㄣ 提交于 2019-11-28 12:34:00
I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver. Can you please tell me what might be the problem? Turbo-C, much like my first girlfriend, will always have a special place in my heart. But its time to let her go. She's not the same girl you remember, and just cannot keep up with modern times. She may have been hip and

How to fix “unable to open stdio.h in Turbo C” error?

做~自己de王妃 提交于 2019-11-28 11:21:22
Whenever I compile my program, I get the error above. Amit If you have problems like that, first of all your TC folder put in to the C:..drive. after completing installation open turbo c blue screen. there is a OPTIONS > Directories ..in that you can see for option to set up path.. include directories..you can set path there now.. C:\TC\INCUDE libraries Directories..you can set path there... C:\TC\LIB if you want to store your output in BIN then you can set.. C:\TC\BIN ..otherwise you can set another path where you want to store your output.. Finally you can give OK and finished processes.. It

How does C++ store functions and objects in memory? [duplicate]

大兔子大兔子 提交于 2019-11-28 07:22:34
问题 This question already has answers here : What will happen when I call a member function on a NULL object pointer? (6 answers) Closed last year . Lets say we have a class class A { int x; public: void sayHi() { cout<<"Hi"; } }; int main() { A *a=NULL; a->sayHi(); } The above code will compile on Turbo C (where I tested) and print Hi as output. I was expecting crash because a is NULL . More over if I make sayHi() function virtual, it says Abnormal temination(Segmentation fault in gcc) I know a

Why the range of int is -32768 to 32767? [closed]

情到浓时终转凉″ 提交于 2019-11-27 19:48:01
Why the range of any data type is greater on negative side as compare to positive side? For example, in case of integer: In Turbo C its range is -32768 to 32767 and for Visual Studio it is -2147483648 to 2147483647 . The same happens to other data types... [UPD: Set proper limit values for Visual Studio ] Because of how numbers are stored. Signed numbers are stored using something called "two's complement notation". Remember all variables have a certain amount of bits. If the most significant one of them, the one on the left, is a 0, then the number is non-negative (i.e., positive or zero),

Problem with operator precedence [duplicate]

谁都会走 提交于 2019-11-27 16:29:06
This question already has an answer here: Why does “++x || ++y && ++z” calculate “++x” first, even though operator “&&” has higher precedence than “||” 11 answers The O/p comes out to be x=2,y=1,z=1 which doesnt agree with the operator precedence. I was running this on Turbo c++ compiler: void main() { int x,y,z,q; x=y=z=1; q=++x || ++y && ++z; printf("x=%d y=%d z=%d",x,y,z); } Operator precedence does not in any way determine the order in which the operators are executed. Operator precedence only defines the grouping between operators and their operands. In your case, operator precedence says

Shouldn't an int pointer in Turbo C be of size 4 bytes?

筅森魡賤 提交于 2019-11-27 16:24:18
In the Turbo C compiler, the size of an int pointer is shown as 2 bytes when sizeof() operator is used. Now, if I print the address of an int variable, it comes out to be a hexadecimal number of 8 digits, which makes the size of address to be 32 bits (or 4 bytes). So, why is the Turbo compiler showing 2 bytes size for the pointer? Your program is compiled under the small memory model, meaning that your entire data space takes up no more than 64K of space. When the program starts, the DS register is pointed at that data space, so pointers only need to be 16 bits to reference any location in the