LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-09-2004, 03:41 AM   #1
khucinx
LQ Newbie
 
Registered: May 2004
Posts: 23

Rep: Reputation: 15
Question 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

Last edited by khucinx; 06-09-2004 at 06:45 AM.
 
Old 06-09-2004, 04:04 AM   #2
Kumar
Member
 
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Word won't word wrap Micro420 General 1 06-13-2005 04:36 PM
Read a word in a string with bash orgazmo Programming 6 06-07-2005 10:19 AM
please read it i dont know the exact word to use to describe wat i wanna say pranith Slackware 5 05-30-2005 07:27 AM
get word from terminal, how to? khucinx Programming 3 06-29-2004 07:48 PM
How to read ans parse MS word file using a Linux Shell script. Alek Linux - General 2 11-10-2003 02:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration