ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
1stly I've searched the forum and read relevant post and am still none the wiser!!! I am currently trying to learn C++, and at college we use the M$ compiler and at home I have Bloodshed and Redhat 9. A task was to use buffered and unbuffered input and output. The functions given with a brief explanation were:- _kbhit , ungetch , getch , getche , putch , and cputs to start with.
//Example of _kbhit
#include <stdio.h>
#include <conio.h>
int main()
{
cputs ("Hit any character ket when ready\n");
while (! _kbhit())
; //inifinite loop til a key pressed
cputs("The key pressed was ");
putch(getch());
putch('\n');
return 0;
}
The above works fine on bloodshed and M$ but gives numerous errors when compiling with g++, any help will be greatly aprecited!!
Hi,
First thing that you should know is that C on Linux/*nix is different than C on M$. Programs written for M$ cannot be so easily ported on the Linux/*nix and vice-versa. So, header files,functions and system calls which you have used on M$ may or maynot be available on Linux/*nix(like conio.h, kbhit() etc). So, the best way which I can think of is to get hold of a good book/docs which teaches c/c++ on linux. This will be much better I suppose. Hope this helps
The best thing to do is learn the standard to then know what is portable and what is not. Then you can abstract the non portable implementation away from the 'real' code..
Marshall Cline, has a book (the real paper back one, not the online lite version) covers most of the important aspects of using the C++ standard and I recommend it to all programmers (not only C++ programmers).
And The C++ Professional Handbook covers the standard to a technically detailed level (down to some specific compiler implementation details). And is another book I would recommend to every C++ programmer.
Originally posted by ugenn When it comes to C++, the ONE book u must read is The C++ Programming Language by Bjarne Stroustrup.
Can't disagree more. That is definitely not a book to give someone who's a C++ newbie. I know, cause I've been through that purgatory.
A much better book for beginners would be C++ Primer by Stanley B. Lippman and Josée Lajoie.
That said, Stroustrup's book is a good reference material for one reason -- since Bjarne is C++, if his book says one thing and the compiler disagrees, then the compiler needs to be changed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.