![]() |
Help with simple program
OK I'm trying to have a simple loop which keeps on printing each number from 1,2,... on a different line and it keeps on doing so until the user enters 'e'.
e.g for(i=0;i<=9999999999;i++) { printf("%d\n",i); } It does not take any input from user and keeps on printing but as soon as user presses e the program exits.Any clue how to go about this. |
Re: Help with simple program
so it should continue printing until the user presses E?
|
Re: Help with simple program
Use the following program for printing the integer value unless press E or e. This example will help for your requirement.
Code:
|
Re: Help with simple program
Quote:
|
Re: Help with simple program
Quote:
with getchar you stop the execution of the program until the user press enter. certainly not what he wants. And no this is not a simple program. There is not an easy way to do it(especially platform independent). |
Re: Help with simple program
You need thread or process creation and some signal stuff.
Create a child process which will print the numbers and the parent process will take user input. |
Re: Help with simple program
Quote:
|
Re: Help with simple program
Yup exactly guys could any one help me with this.How to go about it.
|
Re: Help with simple program
in which operation system?
|
Re: Help with simple program
Well the main thing u r missing is
Scanf its user input? where will user enter? |
| All times are GMT +5.5. The time now is 00:58. |