问题描述
我在 Windows 7 64 位上使用我的古董 Borland Builder 5.
I am using my antique Borland Builder 5 with Windows 7 64-bit.
fptr=fopen("\prn","wb") 失败."prn", "prn:" 也失败了.
fptr=fopen("\prn","wb") fails. "prn", "prn:" also fail.
fptr=fopen("HP8 lj4","wb") 成功.但不打印任何东西.HP8 lj4"是打印机的名称;在控制面板中,或通过net view hp8gig".
fptr=fopen("HP8 lj4","wb") succeeds. But doesn't print anything. The "HP8 lj4" is the name of a printer; in control panel, or via "net view hp8gig".
控制台命令 { print/D:"HP8 lj4"shopping.ln } 说shopping.ln 当前正在打印"——但也没有打印任何内容.
The console command { print /D:"HP8 lj4" shopping.ln } says "shopping.ln is currently being printed" -- but doesn't print anything either.
当然,我一直在这台打印机上打印东西.我漂亮的 ASCII TSE 编辑器可以做到.
Of course I print things on that printer all the time. My beautiful ASCII TSE editor can do it.
有人知道如何从 Windows 7 中的控制台程序打印吗?
Anybody know how to print from a console program in Windows 7?
//2011 年 9 月 12 日星期一下午 5:29.后来我意识到我的HP8 lj4"正在打印到具有该名称的文件中.我试图在这里发表评论,但显然失败了......
//Monday, September 12, 2011 5:29 pm. Later I realized my "HP8 lj4" was printing to a file with that name. And I tried to comment here, but apparently failed....
推荐答案
2011 年 9 月 13 日星期二下午 4:05.在 Windows 7 等中,从面向prn"的控制台程序打印的方式是net use lpt1:\hp8gig\UrPrinter/PERSISTENT:YES".UrPrinter"必须是共享的".这就是全部;我那可怜的小控制台程序现在可以正常打印了.除了天赋之外,我感到困惑的一个原因是所需的打印机是本地.它连接到计算机 - 但通过 USB.执行此操作后,将打印类似复制文件/b prn"的命令行.
Tue 9/13/2011 4:05 pm. The way to print from a console "prn"-oriented program in Windows 7 et al is "net use lpt1: \hp8gig\UrPrinter /PERSISTENT:YES". "UrPrinter" must be "shared". And that's all it takes; my wretched little console program prints fine now. One reason I got confused, aside from natural talent, was that the desired printer was local. It was attached to the computer -- but via USB. After doing this, a command-line like "copy file /b prn" prints.
我之前显然知道这一点——我在我编写的printnet.bat"文件中找到了它,以便从另一台计算机访问网络打印机——但显然我忘记了.
I knew this before apparently -- I found it in a "printnet.bat" file I wrote, to access a network printer from another computer -- but obviously I forgot.
所以我之前提到的网站上的代码被破坏了——一些错别字——即使它有效,也没有.也就是说,我仍然不知道如何以编程方式做净使用"的事情.
So the code from the web site I mentioned before was broken -- a few typos -- and even when it worked, didn't. Which is to say, I still don't know how to programmatically do the "net use" thing.
这篇关于64 位 Windows 7 fopen prn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!