Path: utzoo!attcan!uunet!seas.gwu.edu!mfeldman From: mfeldman@seas.gwu.edu (Michael Feldman) Newsgroups: comp.lang.ada Subject: Re: Help! Message-ID: <2178@sparko.gwu.edu> Date: 25 Sep 90 16:23:54 GMT References: <9009241422.AA17160@wrdis01.af.mil> Reply-To: mfeldman@seas.gwu.edu () Organization: The George Washington University, Washington D.C. Lines: 52 In article <9009241422.AA17160@wrdis01.af.mil> kmccook@WRDIS01.AF.MIL (Ken McCook;SCDQ;) writes: >I'm working on a MIS project to be hosted on PC using MS-DOS >and Ada. Have Alsys PC286 Ada Compiler. > >I'd prefer to write directly to the printer, but I could live >with having to write to a file and then printing the file. You probably can write to the printer. See below. > >I had hoped that Ada's Text_IO would have the capabilities >Turbo Pascal has for directing output directly to the printer >using Write and WriteLn? (And I'd hoped for direct keyboard >reading as well like someone else on the net in recent days. >Something like Turbo's "Read (kbd, X);".) Text_IO does have "hooks" for doing this. Every CREATE or OPEN call associates a file variable in your program with a string representing the file's name as known to the operating system. I'm not all that familiar with the Alsys system, but conjecture based on experience that they provide a standard file name something like PRN or LPT1. Using Meridian Ada, you'd write My_File_Name: Text_IO.File_Type; ...... Text_IO.Create(File => My_File_Name, Mode => Text_IO.Out_File, Name => "PRN"); and then all PUTs to My_File_Name would go to the printer. No, Ada does not predefine the standard names, but probably it could not easily do so because file naming conventions differ greatly from OS to OS (consider DOS names with their 8-character limit vs. Unix names, etc. etc.). So Ada does it JUST LIKE THE OTHER LANGUAGES, leaving it to the programmer to do the mapping with a Create or Open call. Turbo Pascal is an exception, not the rule, and can get away with it because Turbo Pascal exists (currently) only for the DOS world. What is called Turbo Pascal for the Macintosh, for example, is an entirely different Pascal-like language. And surely the file names are different between DOS and MacOS. The bottom line: most likely Alsys provides the standard DOS file names for you to use. Try it. --------------------------------------------------------------------------- Prof. Michael Feldman Department of Electrical Engineering and Computer Science The George Washington University Washington, DC 20052 202-994-5253 mfeldman@seas.gwu.edu ---------------------------------------------------------------------------