LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   read word on terminal? (https://www.linuxquestions.org/questions/programming-9/read-word-on-terminal-191400/)

khucinx 06-09-2004 03:41 AM

read word on terminal?
 
i have c code (mycode.c) like this :
#include<stdio.h>
int main()
{
printf("word\n");
return 0;
}
when i execute them, so the terminal is look like :
#./mycode
word

i want to get "word" in terminal into get_word.c.
#include<stdio.h>
int main()
{
char *word_from_terminal;
word_from_terminal = ............ /*this variable is refers to word in terminal*/
printf("%s\n",word_from_terminal);
return 0;
}

the output of get_word is :
#./get_word
word

would you tell me what is code in .......... like?

thank's

Kumar 06-09-2004 04:04 AM

Hi,
I don't think i've understood the problem fully enough. I guess you want to redirect the output to a differnet terminal...so u have to give the command as -

echo `./a.out`>/dev/tty1


All times are GMT -5. The time now is 10:42 PM.