first I want to apologize for my bad English and second for this topic, I didnt find anything like this so I create it.
My problem is:
I want to create a game where I want to use conio2.h, but problem is, that I cant find it on the internet. Still I find something with Linux, but I need it on windows. Im using CodeBlocks, it is good program but it doesnt have this library
Can you help me guys?
Conio is an old MS-DOS header. You will not find it in modern compilers. For Unix/Linux systems, you can use curses, Windows Systems have their own libraries and functions.
You may want to ask a question on how to do something specific you are having problems with and posting some code.
For example, setting the cursor position can be done with SetConsoleCursorPosition .
Related
It's been many years since I've looked into this. Maybe when I was just getting into C++. But is it still possible to achieve MS-DOS like graphics on a command line interface? Obviously with some small hacks that you can achieve the color scheme. However I'm looking more into menu options. I.e. radio controls menu select.
And yes I know you can also achieve this probably a little bit easier using SDL. But I was just curious if anyone else has accomplish this and has some details posted on the Internet or can possibly point me in the right direction. If this is not as easy to achieve anymore on windows 10 I'll just go on and find something else to do for fun.
Thanks.
Yes, absolutely. You can either use functions such as Set/GetConsoleScreenBufferInformationEx or you can enable VT-100 escape sequences and use those (you'll remember this as ANSI.sys in DOS).
That's the more portable method, as the only windows-specific part should be enabling VT-100 mode, everything else should be the same on Linux.
SetConsoleMode: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx
Or to read and write the console buffer directly:
Console APIs: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx
I have been looking through previous questions regarding this topic and so far none of them answer my question. I am looking for a way (without libraries) to build my own TUI from the ground up. I want to start off with a simple program that reads a directory and displays the contents with the ability to use arrow keys to move up and down highlighting one item. As simple as this may seem this would be all the help I need to get started on the rest of my project.
All I need is for someone to point me in the right direction for clearing and printing to the screen and not using a print statement or external library. Any help would be greatly appreciated.
Well, to be honest, you can. But as others will tell you, curses is the right tool for the job.
That said, this isn't the 80s anymore. <overgeneralization>Everybody uses Xterm.</overgeneralization> Xterm uses ANSI VT100 control codes, mimicking the classic DEC VT-100. If you target this, you should be reasonably ok and portable.
But curses is really nice. It does a lot of the hard work for you (and there's plenty of hard work left to keep you busy).
So being new to the C language i want to program a simple window or GUI. are there any good web pages or books i could get to learn how to do this? I've searched around on the net and haven't come up with anything! or if someone could send me on the right track like what to #include and maybe some important commands that i will need that would be awesome! thanks!
Check out GTK. You didn't say what OS you are using. GTK is cross platform, but easiest to use on Linux.
You need a gui toolkit, you can either use one built into your OS (eg the Win32 API on windows) or pick a platform independant one
Qt http://qt.nokia.com/ is probably the most popular full featured one, or you can start with something quicker and easy like http://www.fltk.org/
Umm, I've been using Eclipse for Java development and I am trying to use it now for making C apps.
The problem is that I don't feel too comfortable with it. Namely:
I need to include headers by hand, i.e. not automatically.
I've never seen a 'quickfix' to be available for any problem.
I can't spot the problem before it has been compiled.
Any ideas on how I could make myself feel a bit better?
Sorry if my questions are rather stupid, but getting the way down from Java to C is rather hard on me.
Thanks!
Yeah its a little harder to go from Java to C, Java didn't exist when I was programming C.
Some comments:
Automatically including headers is difficult in C
See #include headers in C/C++
You could use lint to catch some errors...
http://syncor.blogspot.com/2010/03/using-lint-in-eclipse-with-netburner.html
Consider doing TDD using something like gTest, and automate your build process.
http://www.slideshare.net/amritayan/test-driven-development-in-c, might help you develop a different rhythm.
gtest in Eclipse ... https://github.com/ospector/gtest-gbar
Have fun!
On Mac OS XCode is an option.
On startup:
New Application -> Command Line Tool ->Type C
And Bob is your proverbial (aunty).
You get all the XCode short cuts & hit ESC in your editor window for code completion.
Hmmm.... think I'll start using it actually. ;-)
re:
I can't spot the problem before it has
been compiled.
You can get immediate feedback on syntax errors. They show up as question marks in the left gutter and yellow squiggly lines under the error. This happens immediately. Make sure under Window->Preferences-General->Editors->Text Editors->Annotations that you have the "Show in" checkboxes checked for the C/C++ Indexer Markers and C/C++ Occurrences.
What could some of you recommend for using when learning C and programming with C?
I have thought of the following options. (On OSX)
Aquamacs
TextMate and the Terminal
XCode
I want to learn more than just the IDE so that I grasp the concept as I will be learning about compilers etc.
I tried Aquamacs when learning Erlang but it was more of a hassle than I enjoyed.
Is there a lot extra to learn when using an Emacs environment?
What is most beneficial for understanding how things work. ( C )
Are there any other tools or possible options worth looking into?
Thanks
If what you want to learn is C Programming Language in Mac OS X I would go with XCode. It has a very good GDB integration, and its learning curve is smoother that EMACS' or just writing your own Makefiles.
If you want to learn about C, in my opinion, you should use the most basic editor available, compile using the terminal with gcc. And that's it.
Once you'll understand the language, picking one IDE over an other will be a no brainer.
But no IDE will really teach you anything about C.
There's also BBEdit on OSX. (I've used it briefly in the OS8 days.) As far as learning C goes, there are a number of books that you can try. I'd pop down to whatever chain bookstore is closest and browse the Programming section.
I'd also invest in a good algorithm book.
If you want to use Emacs as an IDE, you will need to write Makefile in order to be able to compile from within Emacs. Writing Makefile could help you understand the compiler options, object code, linking and such.
So to use Emacs as IDE for learning C, you should be using C-mode, know about M-x compile and using gdb under Emacs(M-x gdb). To look up man pages for library functions, M-x man and supply it (3 printf, for example to read the man page of C I/O function printf) the section number and function name.
I am not sure if using Emacs+Makefile this way is most beneficial in helping you teach how to compile, link, build etc, but it sure does help in learning those ideas.
If you're not comfortable using a more advanced editor like vim or emacs, then I would suggest using TextMate or something similar. This would let you concentrate on the code you're writing rather than struggling to learn how to use the editor.
Using a full blown IDE like XCode will also allow you to pretty much ignore the build system while you're still learning the language itself. Once you get comfortable with C, learning things like make or cmake would be less overwhelming.
Then after that, maybe you can go back to check out vim or emacs and see what a more complex editor can do for you, if anything.