Re: Printing Help

new topic     » goto parent     » topic index » view thread      » older message » newer message

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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu