scanf
Below is a simple code usnig scanf
===============================
char buffer[100];
while(1){
printf("> ");
scanf("%s", buffer);
}
================================
which will get input. and print ">" and wait another.
The problem I have is if I press "Enter" without any input.
It'll just halt there untill I do actually put some input and press "Enter".
Which works different as what I want. I thought if I press "Enter" without any input, buffer will just store "\0";
=================================
Anyway to modify it?
|