Sender: vheyndri AT rug DOT ac DOT be Message-Id: <35403B8A.776D@rug.ac.be> Date: Fri, 24 Apr 1998 09:13:14 +0200 From: Vik Heyndrickx Mime-Version: 1.0 Newsgroups: comp.os.msdos.djgpp To: Matti Haavikko Cc: djgpp AT delorie DOT com Subject: Re: Interfacing with printer References: <353ec46f DOT 9950927 AT news DOT sci DOT fi> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Matti Haavikko wrote: > > I have run in trouble with my printer. > When I fopen() "lpt1", it gives no error even if no printer is > connected. This happens because lpt1 is not really the printer, but the printer port which *is* present. Technically, you don't need a printer connected to the other end of the cable. You could also have e.g. a computer connected to it. Since the hardware port doesn't necessarily see whether something is connected to it, DOS never fails to open it. > When I fprintf() to the *FILE fopen gave me, it happily returns the > number of characters written, whether they really print or not. Does someone know whether full buffering is enabled for devices not related to tty? It probably is, which means that the bytes you send to the printer first will end up into a memory buffer associated with that file handle. Until the buffer is full, nothing will be effectively written (unless you call fflush), which of course cannot yield an error situation. > How can I > * output some text to the printer and see, if the print operation > actually succeeded? Try to switch FULL buffering off temporarily (function setvbuf), and then write something to the printer. I cannot say I know this works, however... -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/ Knight in the Order of the Unsigned Types