Re: Printing Help
- Posted by Jason Gade <jaygade at yahoo.com> Feb 09, 2006
- 553 views
Jason Gade wrote: > > George Walters wrote: > > > > > > I'm trying to open and print to a network printer like this > > > > }}} <eucode> > > dosFn = open("IP_192.168.1.52", "w") -- a windows port > > prtFn = open(args[3], "r") > > if dosFn !=0 then > > tmp = gets(prtFn) > > while not atom(tmp) do > > if find("+p", tmp) then > > puts(dosFn, 12) > > else > > puts(dosFn,tmp) > > end if > > --puts(1, tmp) > > tmp = gets(prtFn) > > end while > > close(dosFn) > > end if > > </eucode> {{{ > > > > However the program works fine but prints to a file of that name and not > > to the port where the printer is attached. > > > > What have I done wrong, or can I not do this. > > > > I have working routines using win32 but for this application I wanted to > > print > > directly to the printer. > > I don't think you can open an IP that way, you probably have to use some kind > of networking library. > > But the main reason I replied is that open() will return -1, not 0, if it > fails. > -- > "Any programming problem can be solved by adding a level of indirection." > --anonymous > "Any performance problem can be solved by removing a level of indirection." > --M. Haertel > j. But with a little googling and experimenting, I found that you can print a file with the following line (just make sure the printer you want is set as the default printer)
system("start /min /normal notepad.exe /p " & args[3],2)
-- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel j.