Category: Programming

I had enrolled my self for java workshop which took my precious last four weekends (sat-sun). I just can’t express how the very thought of coming free (hopefully!!) weekends is filling me with joy…

Nah! I am not complainting after all it was my decision to join the course but nevertheless it ate my four weekends, it could have been on anyother day like workingdays??

Lets talk about actual classes now..

I have to admit these classes were one of the best things that have happened lately, at least for me. They were very helpfull, they just didn’t help us in learning java only but tought us much more than that like – best coding practices, efficient coding style, new way of interpreting given scenario in terms of classes and objects. Actual essense of data hiding, inheritance, encapsulation. Before these classes, though i could define these terms by the book but never understood the underlying meaning of them, they all seemed same to me [ data hiding = encapsulation??]. The very meaning of object oriented was a bit shady. But now i can clearly see the difference. What an eye opener!!!

I really liked, how our instructor use to play small music tracks at the begining of each session. One more thing worth mention is his (instructor’s) way of teaching – just imagine attending a class of single subject for 6 hrs, scary isn’t it? but believe me, when i say, we never felt bored or tired, thanks to sir’s small but effective stories and jokes..We all were immensely benifited by his industrial experience and feel pity for other who didn’t attend this workshop.

Let me sum it up again – this workshop wasn’t about learning Java language but how to program NICELY.

I am eagerly waiting for more such workshops organised by our college (ofcourse joining them will directly depend on cash in my pocket)

BGI (Borland Graphics Interface) is ancient as is turbo c++ IDE but nevertheless they are still used in our schools and colleges. Plus they do not work in windows environment (support for native DOS has been completely removed in windows vista/7).

But BGI is good for beginners because you don’t have to worry about whole new fancy functions,classes etc.

So few months back i was also searching for alternative to BGI (not supported on windows) and i found

open sdl

ogre

and some other but they were all very exotic.

So again, i was back on my quest and finally i stumbled upon WinBGI.

WinBGIm is BGI graphics library ported to computer by by Michael Main at the University of ColoradoBoon isn’t it!

Now it was ported to work with MinGW compiler (my favourite) but it may also work with other compilers such as – digital mars, borland compiler 5.5, intel c/c++ compiler etc.

Before i start, i must tell you that this guide is written in accordance with code::blocks IDE (its the best and its free, check out my previous posts). So if you are using some other IDE or none at all (command-line method) – you’ll need to link with the libraries explicitly. For example, to compile a program (“myprog.c“) that uses the BGI graphics, your compile command may look something like:
c:\programs\myprog> gcc myprog.c -lbgi -lgdi32 -luser32

Now i will guide you through the whole process of running turbo c++ in windows vista or windows 7 environment.
Things Required:
1. DosBox 0.73
2. Turbo C++

Procedure:
1. Install Dosbox in default location.
2. Install Turbo C. (default location is C:\TurboC3\)
3. Open folder (default – C:\TurboC3\) where you installed turbo c and create a new folder named TC.
4. Copy all other files and folders into TC folder.
So that now address of tc folder should be c:\TurboC3\TC\ 5. Now go to Start>>All Programs>>DOSBox>>Configuration>>Edit configuration.
6. Make following changes in the file.(Use notepad to edit the file,if computer asks for. )

(1) under [sdl]

fullscreen=true
fullresolution=1280×800(Or you can put 640×480,800×600,1024×768)
(For most latest laptops 1280×800 will be best.)
output=opengl(if it doesn’t work or colors seem messed up, change it to ddraw)

(2) under [autoexec]

(paste following lines)
mount c c:\turboc3
c:
cd \tc
tc

exit

7. Save file.
8. Now launch DOSBox from desktop or start menu and after 3-5 sec delay, hopefully you will see turbo C with eyes and hands intact.
9. Go to Options>>Directories
10. In all four paths replace turboc3 with tc.

Now you are all set to unleash the programming monster in you.

***********
* Warning *
***********

@ Don’t use ctrl+f9 to “compile and run” instead use alt+f9 to “complie” and then click run.
in case you do press ctrl+f9, it will close DOSBox.

Note:

DOSBox is emulating c:\turboc3\ as C: root, so you will be required to save your programs in a folder inside c:\turboc3\
What???????

Make a new folder inside c:\turboc3\
Name it whatever you want and save your programs inside it.

— If you use linux OS even then you can follow above procedure to emulate turbo c through dosbox

Just search for dosbox in repositories.

@@@@@@@@@@@@@@@@@@@@@@@@@@

For any other queries mail to: gagsays@gmail.com
Or you can leave comment on my blog http://www.gagsays.tk
And ofcourse if your in my college/class, ask me anytime.

Would you believe not only in schools but also ENGINEERING colleges like ours (censor), instructors are teaching us wrong way of c/c++ coding and i am sure even they don’t know about it.

Moreover we are using really obsolete IDE turbo c++, which is a complete resource hog (i read so in some programming journal) and its compiler doesn’t complies with new standard of c/c++ which are maintained by ANSI.

As i have recently started using linux ubuntu (for my old readers, today its 4th day where i have successfully avoided windows.) i am finding it a bit hard to program and can you guess why?????

Because we, C/C++ programmers are allowed to do some things they shouldn’t. We are given functions that are supposed to be useful but aren’t because of hidden faults, or taught ways to do things that are bad, wrong, not necessary.

Like i can’t use getch(),clrscr() and many more (i dont know much) with gcc compiler. First i thought it was because of linux or my compiler ie those functions are windows specific like exit() etc.

But no!

Those function does not work on linux because either they do not comply to ANSI standard or obsolete.

I also found (as reported by gcc compiler) that gets funtion, which we use without any second thought is a very DANGEROUS function.

So while finding alternative for clrscr() and getch() function on Internet, i came around this site which tell us

in there you will find, why we must not use gets,fflush(stdin) or even scanf() (shocking!! isn’t it)

Now friends, i am not asking you (can i??) to remove them from your hard learned programs or else who will explain it to our blinded teachers that they are wrong but atleast we must remain updated with such info, who knows when it can come handy.