ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am a university student doing a project on uClinux Coldfire boards. I am faced with a daunting yet simple problem which I can't get my head around.
Is there any way for me to check for user input when inside a while loop? If the user hasn't inputed anything then the while loop just continues. Basically I want the user to be able to terminate the while loop.
At the moment scanf and other similar functions that I know wait for user input. There is no timeout.
Does anyone know of a better alternative than this. I can't really fork out a new process because of uClinux only supports vfork.
... i've never used c in practice, so i may be wrong, but maybe you could test stdin against true or false and so decide if there was any input. on second taught, there really must be an option to read (a byte) directly from stdin, and it should be zero if no input.
but... ...you never know
Use select() for this. Add STDIN in the read list of select and set the timer value to 0. This way when the the application will come to select(), it will simply check if the there in some input. If there is not input if will immidiately go forward.