Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C Keywords: Hercules problems Message-ID: <1990Aug5.152130.6211@Octopus.COM> Date: 5 Aug 90 15:21:30 GMT References: <789@usage.csd.unsw.oz.au> Reply-To: stever@octopus.UUCP (Steve Resnick ) Organization: Octopus Enterprises, Cupertino CA Lines: 54 In article <789@usage.csd.unsw.oz.au> dennett@usage.csd.unsw.oz.au (Dennett Jaques) writes: > >G'day there, > G'day ! >I am having a small problem with some functions in Turbo C 2.01 relating >to 'gets' and 'scanf' when in graphics mode. > >The program runs fine on EGA VGA displays but the same code when run on >Hercules equipped machines causes small lines of scattered pixels to be >displayed across the top half of the screen at the point where 'scanf' or >'gets' are called. Additional pixels appear as keyboard input is processed >by these functions. No characters are echoed to the screen at this time >although they should be, EGA and VGA OK here. > >On the other hand if I program using 'getch' in place of the above - this >works for all types of graphics cards. >But this method is too sloppy. > >The above code first uses 'InitGraph' to determin display hardware. > >Anybody have any thoughts? > > Time for some good news and some bad news....The good news: DOS uses the BIOS for video output when not redirected. When you call gets, or scanf (or anything else that reads stdin and echoes to the console the BIOS is called upon to draw your characters. If the EGA/VGA is in graphics mode, the characters are still drawn nicely (but more slowly) on the screen and all is well. The bad news: The BIOS video services still think the herc is in mode 7 - MDA text mode when you are in a hercules graphics mode. This is why you get extra pixels and no text. To read a string from the console in a herc graphics mode I believe you will have to code this yourselfand it may mean using a BGI font rather than the PC's normal font. If this is a workable solution, I have a routine I could mail you (it is at work, and I am at home or I would post it here) which reads characters from the console, takes care of editing, etc and deals with "cursor" movement (there is normally no cursor in graphics mode). If this is something that is workable for you let me know and I will e-mail you the source for this routine (gcgets) it's only about 15 lines of code. If anyone else is interested, let me know, and I will post it here as well.. :) Hope this helps..... Steve -- ---------------------------------------------------------------------------- steve.resnick@f105.n143.z1@FIDONET.ORG #include Flames, grammar errors, spelling errrors >/dev/nul ----------------------------------------------------------------------------