LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-23-2003, 11:02 PM   #1
umdkappy
LQ Newbie
 
Registered: Nov 2003
Posts: 6

Rep: Reputation: 0
Sending console output to windows printer


I dont know if theres any easy way to do this. Im a noob and just setup an old 486sx box running zipslack 7.1....I mainly use this machine to write C programs for one of my classes. I use VI to write the code, but our professor requires we submit the output of hte code also....My 2 computers, this one(XP Pro with Deskjet930 connected via USB) and the 486 box are both networked through a hub in my room which then connects to the wall jack. I can access my windows machine via ftp, so I know that they can talk to each other.

Anyways, I need to know how I can send the output of the code which is displayed in the console to my windows printer...If possible i need step by step instructsions, because im clueless. My zipslack box has no GUI, only the console text mode...thanks in advance
 
Old 11-24-2003, 12:57 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,477

Rep: Reputation: 191Reputation: 191
Not sure if this will help, but you can redirect the output of your program to a text file with:

$ ./program_name > output.txt

and then transfer the text file to one of your boxes that has print capabilities. The above command will create the text file in the current directory but you can direct it anywhere by designating the path.
 
Old 11-24-2003, 03:40 AM   #3
umdkappy
LQ Newbie
 
Registered: Nov 2003
Posts: 6

Original Poster
Rep: Reputation: 0
actually, yea that helps a lot man, thanks
 
Old 11-24-2003, 03:43 AM   #4
umdkappy
LQ Newbie
 
Registered: Nov 2003
Posts: 6

Original Poster
Rep: Reputation: 0
actually, i jsut tried it, is there anyway to have it store the inputs to? It saves the output, however, the things i type, dont show up in the text file
 
Old 11-24-2003, 10:29 AM   #5
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,477

Rep: Reputation: 191Reputation: 191
That's what I was afraid of - if you have an interactive program where you must enter a series of inputs it won't work. But there's got to be an easy way to do it. I almost always use a gui and there it's easy; you run your program in a console, highlight everything you want to save with your mouse; create an empty text file and if you click left and right mouse together(or click the wheel if you have one) the highlighted text will be copied to the text file. There's got to be a way to do from the cli but I'm just not that familiar enough with it to give you meaningful advice. I guess the issue is how do you select text from the cli for copying and pasting in a text file.

One thing you might want to consider is downloading knoppix; it's a linux distro that runs entirely of a bootable cd and boots in a gui(kde). It comes with gcc so you should be able to compile programs. Knoppix is fairly ram intensive since it runs in a ram disk so you would probably have to run it on your XP box. However, knoppix has excellent hardware detection and may even pick up your printer on your XP box. The plan would be to boot into knoppix, write your code in any of the many text editors and save it to a floppy; open a console and compile the code and run the program; highlight the output you want to save and save it to a text file on your floppy or if you can print in knoppix save the output to a text file created in knoppix and print it out.
 
Old 11-25-2003, 04:16 PM   #6
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,477

Rep: Reputation: 191Reputation: 191
I found it - an easy way. The command you want is called "script". If you run:

$ script output.txt

it will print the entire session to the text file "ouput.txt" starting for everything after you enter the command. Hitting Ctrl-D will stop script from outputting anymore to the file.

Run:

$ man script

for more info on the script command. Here's a quote from the man pages:

Quote:
Script makes a typescript of everything printed on your terminal. It is
useful for students who need a hardcopy record of an interactive session
as proof of an assignment, as the typescript file can be printed out
later with lpr(1).
Sounds like it's right up your alley.

Last edited by kilgoretrout; 11-25-2003 at 05:29 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sending message to a user's console GUIPenguin Linux - General 1 10-27-2005 12:38 PM
sending messages trough the console haora Linux - Newbie 3 04-01-2005 03:41 PM
Sending output to mail account through cron. gian2oo1 Slackware 2 01-18-2005 01:54 PM
Console output to X? dcm1878 Linux - Software 4 04-23-2003 09:07 PM
Long console output Loke Linux - Newbie 1 02-26-2003 07:35 AM


All times are GMT -5. The time now is 07:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration