PDA

View Full Version : New line in terminal input..



nethan_lor
July 7th, 2008, 09:50 PM
Hi, I want to know if there is any ctrl something to make a new line in console input for a C project ?

I mean I want to write something like :
1 2 3
4 5 6
and then send it with enter instead of
1 2 3 4 5 6 and then enter...

Is there anyway to do that ??

Thanks a lot !

gnusci
July 7th, 2008, 11:35 PM
simply but works!


#include <stdio.h>

int main(void){

char line[1024];

printf("Enter your numbers?\n");
read(0, line, 1024 );
printf("numbers:%s",line);
read(0, line, 1024 );
printf("numbers:%s",line);
read(0, line, 1024 );
printf("numbers:%s",line);

return 0;
}