Xref: utzoo comp.sys.ibm.pc:44713 comp.sys.ibm.pc.programmer:18 Path: utzoo!utgpu!watserv1!watmath!att!dptg!pegasus!psrc From: psrc@pegasus.ATT.COM (Paul S. R. Chisholm) Newsgroups: comp.sys.ibm.pc,comp.sys.ibm.pc.programmer Subject: Re: Sticky Problems with C on IBM-compatibles Summary: RTFMs Keywords: text, printer, display, directory, screen Message-ID: <4467@pegasus.ATT.COM> Date: 18 Feb 90 04:17:36 GMT References: <492@bilver.UUCP> Followup-To: comp.sys.ibm.pc.programmer Organization: AT&T Bell Laboratories Lines: 72 < Krasny Oktyabr: the hunt is on, March 2, 1990 > In article <492@bilver.UUCP>, alex@bilver.UUCP (Alex Matulich) writes: > 1) Is there a faster way to display character strings than using puts() > or printf() without resorting to assembly language? Have you tried the console video functions described in the first part of chapter 8 of the (TC 2.0) User's Guide? > 2) If I have a text screen set up like I want it, is it possible to save > it away somehow so I can display it anytime later by dumping it back > into the video memory? Try gettext(). > 3) How do I display inverse, boldface, or multicolored text without > resorting to using ANSI.SYS? Use the functions I've already mentioned, with textattr(), textcolor(), and textbackground(), as appropriate. > 4) The critical error handler gets invoked when the printer needs more > paper. How do I tell if the printer is offline? The computer hung up > last time I tried using fopen() to get a file handle to a printer that > was powered off. I don't think it'll really hang; it *will* wait for many seconds, giving the printer a chance to get on-line. You'll need to replace the critical error handler (using the setvect() function) with your own. It should check everything you're interested in, and the rest should be ignored or passed to the original handler. Be sure to replace the original when you're done! Check the Norton or Duncan books for details. > 5) If a user of my software has a serial printer, how do I set up the > serial port parameters (baud rate, xon/xoff, databits, stopbits, etc)? I think you're going to have to invoke interrupt 20, service 0 "by hand". (You can do this with the intr() functions, or one of the other int*() functions.) Norton and Duncan have the details. > 6) I expected to find a function somewhere in the standard library that > would read the contents of a disk directory into a string array. Try findfirst() and findnext(). They're not quite what you asked for, but they provide the basics. > 7) If my PATH environment variable is set up so that I can run one of my > programs from a directory different than the one containing my program, > how it possible for my program to determine the directory IT started > from? Or does that information have to be hard-coded in my program? DOS 3.0 and later generate enough information for the TC start-up code to put the path name in argv[0]. In version 1.x and 2.x, your best bet is to (yuchh) search the current directory, and then the path, yourself. > If you know the answers to at least one of the above questions, or if you > know the title of a helpful book I can look up, PLEASE e-mail me a reply. Try the second editions of either of these: THE PETER NORTON PROGRAMMER'S GUIDE TO THE IBM PC by (surprise) Peter Norton, or Ray Duncan's ADVANCED MS-DOS. > /// Alex Matulich > /// Unicorn Research Corp, 4621 N Landmark Dr, Orlando, FL 32817 > \\\/// alex@bilver.UUCP ...uunet!tarpit!bilver!alex > \XX/ From BitNet use: bilver!alex@uunet.uu.net Paul S. R. Chisholm, AT&T Bell Laboratories att!pegasus!psrc, psrc@pegasus.att.com, AT&T Mail !psrchisholm I'm not speaking for the company, I'm just speaking my mind.