0

I need to develop a Gui application but I have three problems:
1) I'll have to use only C language.
2) I cannot use GTK.
3) I cannot use any other Compiler than Turbo C/C++. (College restriction :/)
Is there any solution for this ? I am using Windows Operating system.

Sam
  • 925
  • 1
  • 12
  • 28
  • I could have done it much before if I can :| – Sam Jun 15 '14 at 20:22
  • 1
    Turbo C's last version was 25 years ago. If you mean Turbo C++ (which does support C), that was last released 21 years ago. – hobbs Jun 15 '14 at 20:22
  • Yeah I mean Turbo C/C++. Any solutions ? – Sam Jun 15 '14 at 20:24
  • 1
    What about Qt, wxWidgets, FLTK, etc? – ooga Jun 15 '14 at 20:28
  • 1
    Sounds to me like you are going to need to use the Windows API for the graphical user interface to create and manage windows. So that would be [CreateWindow() function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms632679(v=vs.85).aspx) and similar Windows API that have a C interface. – Richard Chambers Jun 15 '14 at 20:29
  • Turbo can't generate Windows executables, only DOS ones. You could use DOS mouse and graphics libraries to make a DOS-based GUI, but it wouldn't be anything like a Windows app and it wouldn't run on anything newer than Windows XP 32-bit. – hobbs Jun 15 '14 at 20:29
  • Are you using something like http://www.softpedia.com/get/Programming/Coding-languages-Compilers/TurboCplusplus-for-Windows-7.shtml ? – Richard Chambers Jun 15 '14 at 20:31
  • @RichardChambers: yes you got it right. I am using it. Any help now ?
    Does this Turbo version support Windows API ?
    – Sam Jun 15 '14 at 20:48
  • @ooga: All those are c++ library. I can't use them. – Sam Jun 15 '14 at 20:56
  • take a look at http://stackoverflow.com/questions/3134224/windows-h-in-c-using-turbo-c – Richard Chambers Jun 15 '14 at 23:18
  • I suggest you discuss this question with your teacher or professor (I assume this is for a class of some kind). The Windows API for Windows XP is usable from C source code however you will need the proper libraries and the proper DLLs. Also if Turbo C is a 16 bit compiler then you may run into issues with 32 bit addresses. Typically you would use a FAR call with FAR address data (32 bit address composed of segment register and offset). It looks like people have gone to the trouble of creating a dos box, probably some kind of virtual machine thing. Why aren't people going with Eclipse? – Richard Chambers Jun 15 '14 at 23:24
  • And you might find this helpful http://docwiki.embarcadero.com/RADStudio/XE6/en/C%2B%2BBuilder_Developer%27s_Guide though I am not sure if this is the actual Turbo C that you are using. – Richard Chambers Jun 15 '14 at 23:38
  • Try talking to your teacher first. Perhaps he also dislikes TurboC but is also forced (by his management) to use it. – Basile Starynkevitch Feb 02 '15 at 15:33
  • 1
    @haccks this is not necessarily a bad thing. Working with constraints is a good way to teach the basics. Working with something ancient is a way to make sure your teaching knowledge and materials aren't obsolete. The goal isn't to teach you something you can use to get a job tomorrow, it's to teach the fundamentals. I'm so glad to have grown gradually along with the industry, rather than try to drink from the firehose today. – Mark Ransom Feb 02 '15 at 15:38
  • @MarkRansom; I agreed with your views. But, in most cases the scenario is something like this: "*I am an old guy who learned programming on Turbo C++ and do not upgraded my self yet. So, you have to learn my way*". I know a professor in my college who teach us Numerical Analysis and he was a big fan of `goto` statement. He looks for that statement in programs. If the written program is correct and `goto` is not used then he gave us 2 or 3 out of 5. If program is wrong but contains some `goto`, then he gave us `3.5` to `4` out of `5` points. – haccks Feb 02 '15 at 15:49
  • @MarkRansom; And yes, I also do not believe in drinking from fire hose. – haccks Feb 02 '15 at 15:50

2 Answers2

3

Yes you can , The library you'll have to use is called #include "graphics.h" . It's a very primitive library and there are methods ( or functions I should rather say ) for Decorating Text , outputting pixels and drawing very primitive shapes .

for eg) drawCircle(int x,int y, int radius) where x and y are the co-ordinates of the circle

The origin of the co-ordinate system lies to the top left of the Black screen that appears when you press Run on turbo C . It increases towards the right as the x co-ordinate and towards the bottom as the y co-ordinate .

There are no inbuilt functions for translations so if you will have to animate by first drawing a completely black shape over the exact shape you want to move , then move the shape's co-ordinate and then draw it again. There are a host of other things and you can check it out in the help index

0

It depends on the GUI system you want.

If you want something similar to todays' GUI then you can use the graphics.h library as sugested by user1771825.

However if you prefer a more console or dos look, i.e., a text based GUI, then just use instructions like textcolor, textbackground, window and such, or use inline assembler to control the foreground and background colors, text positions and the rest. This is what I used back then to build pull downs menus, dialogs and windows.

john doe
  • 42
  • 6