LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sending console output to windows printer (https://www.linuxquestions.org/questions/linux-newbie-8/sending-console-output-to-windows-printer-119341/)

umdkappy 11-23-2003 10:02 PM

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

kilgoretrout 11-23-2003 11:57 PM

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.

umdkappy 11-24-2003 02:40 AM

actually, yea that helps a lot man, thanks

umdkappy 11-24-2003 02:43 AM

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

kilgoretrout 11-24-2003 09:29 AM

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.

kilgoretrout 11-25-2003 03:16 PM

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.


All times are GMT -5. The time now is 07:25 AM.