Skip to main content
GameDev.net gamedev.net
🔒 Locked

Print

Started by MSalley Jan 25, 2006 at 3:11 PM 2 replies 600+ views
Original Post
MSalley
MSalley
Say I have a file "C:\Windows\jomil.txt". How do I write a simple program (C++) to print it? In command prompt, all you have to do is type: print "C:\Windows\jomil.txt", but I want to do other stuff, like loop it.
-Mat² §alley©-
vinb
vinb
I've never done it, but I just found this code at Redirecting Input and Output. Seems like it should work. By 'loop it' do you mean something like sending pages to the printer in a loop?

Sending output to the printer.1: /* Demonstrates printer output. */2:3: #include <stdio.h>4:5: main()6: {7: float f = 2.0134;8:9: fprintf(stdprn, "\nThis message is printed.\r\n");10: fprintf(stdprn, "And now some numbers:\r\n");11: fprintf(stdprn, "The square of %f is %f.", f, f*f);12:13: /* Send a form feed. */14: fprintf(stdprn, "\f");15:16: return 0;17: }This message is printed.And now some numbers:The square of 2.013400 is 4.053780.
nilkn
nilkn
It's a matter of directing your data to a stream which goes to the printer. See this MSDN article.
Simian Man
Simian Man
What's wrong with just
system("print \"C:\Windows\jomil.txt\"");

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.