@shivi91
It looks like you want graphics, not colored text. (Why didn't you clearly say that anywhere?!?) There are two main kinds of graphics/GUI libraries: First are GUI toolkits (typically used for desktop applications). They provide you with buttons, labels, text entries, and just about any other control you can think of. You can also create your own widget (control) and draw in it. The main choices are GTK+ (or its C++ binding, gtkmm) and Qt. And second there are game libraries (typically used for video games). They mostly handle only image files and are made for drawing complex scenes made out of lots of them really fast. They also often provide functions for audio and input devices, and some support 3D graphics. Popular ones for Linux include SDL and Allegro. |
shivi91: Your code demonstrates that you are trying to produce a GUI. You have code which renders pixel graphics to a computer monitor, and you have code that acquires input from an interactive user.
Code:
/* draw a rectangle */ Your code will never compile and run under Linux directly. There are no libraries that directly implement the semantics given in your code. The Turbo C graphics library is a very poor and incomplete toolkit for developing any kind of GUI (and is the reason that things like Windows and X-Windows were designed). The Turbo C graphics library is targeted to a very specific architecture; one which is very dissimilar to most architectures found on common Linux desktop environments. Your best hope to run the code you posted (ever think of posting in [CODE ] tags?) might be to run it in some kind of emulator. For that, you would need to build it with the native Turbo C compiler. --- rod. |
Quote:
Just check out GTK+ and Qt, pick one (personally I think Qt is easier to work with and has more features), and use it. They even have nice GUI programs to build the interface of your program before you even start writing code (Qt Designer for Qt, and Glade for GTK+). |
dos.h doesn't work either..what should be done for that?
|
There is no direct equivalent of dos.h in standard C.
Instead, use this: http://en.wikipedia.org/wiki/Libc |
Quote:
while ((ch = getch()) != EOF && ch != '\n' && ch != '\r' && i < sizeof(pword))//how would this be converted to linux code.. |
i want the input to be stars like inputing password... that was the code which worked in turbo..
|
Quote:
Please post the code in BBCode [code]code goes here[/code] tags. It will use a monospaced font and preserve indentation. Quote:
|
Quote:
|
Did you read the part of my post about not echoing, and did you understand it? (By the way, why do you keep ignoring so many of our questions? I still don't understand what you meant by "graphics" or what you want to do!)
From what I understand, this should do what you want (warning: not tested). Requires you to include termios.h. Code:
struct termios termios_old, termios_new; |
All times are GMT -5. The time now is 03:26 PM. |