TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Andrew Seeger
from: Frank Adam
date: 1996-09-13 04:11:08
subject: A few questions

G'Day Andrew,
 
-=> Quoting Andrew Seeger to All <=-

 AS> 1... I am writing a program for a mate that has some good ansi work,
 AS> can someone show me a few ways of doing the screens, apart from putting
 AS> them into an array, the screens are over 2k in size. I have looked at
 AS> window, textattr etc, am i looking in the right place? I have tried
 AS> programs that embed the screens, but i dont really have a need to do
 AS> that, but i  would like to have the
 AS> screens contained within the main EXE.
Do the screens have to be ANSI ? 
If so, you could keep them in separate files and just "type" them to 
screen. 
Eg. cmd[20];
    sprintf(cmd,"type %s",ansifile);  
    system(cmd);

If not, then get your hands on VidMgr12.zip and with a bit of practice, 
pretty soon you'll have fast and easy screen access.

 AS> 2... A clock routine, to display the clock and continually 
 AS> updating it, i guess
 AS> i will eventually work it out, but some pointers (no pun intended)
 AS> would be much appreciated.
Ok, that's easy in Borland, here is the one i use. As amateurish as it may 
be, but works.

 #include 
 #include 
 #include 

#pragma warn -def /* tell the compiler who is the boss, it complains
                  about using secs before definition */

void Put_Time(int x, int y)
{
 struct time now;
 static char secs;
 int curx = wherex(); /* save current x,y */
 int cury = wherey();
 gettime(&now);

if(secs != now.ti_sec) /* update it once a sec only ! */
{
 gotoxy(x,y);
 cprintf("%02d:%02d:%02d",now.ti_hour,now.ti_min,now.ti_sec);
 gotoxy(curx,cury);         /* restore xy */
 secs = now.ti_sec;
 }
}
#pragma warn .def /* restore the warnings */

int main( void )
{
 while(!kbhit())
 {
  Put_Time(70,1);
  }
return 0;
}

                                                  
You just call the function from where ever there is a bit of not much to 
do, and it should be fairly smooth. Of course if the program gets tied 
down somewhere for a few seconds the update will not happen, but in most 
cases it's more than adequate. 
Only better solution i thought of at the time, was to hook int08 or 1C 
but i never got around to play with it.      
I wonder if the CMOS could be used directly too...anyone ???               
            

 AS> 3... When i compile a program, i end up with a lot of compiler crap at
 AS> the end of the exe, which shows things like the paths and names of the
 AS> .c source code files etc. How can i clean this up to make it more
Two ways..
1. In the compiler setup switch off "include debug info".
   I don't bother with that because it becomes more a pain in the butt
   when you later forget to switch it back on and go to debug only to be 
   told nasty things about not having debug info.

2. In the BIN directory you'll find a program called tdstrip.exe
   The command line is tdstrip  
   This is what i use normally.Btw, it strips the original exe, so if you
   want to keep the exe with the debug info, make a backup. 
   ..Then again you can always recompile the source.
      
 AS> 4... Book suggestions! So that i may make a more informed choice. I
 AS> already have a book called 'A Book On C' by Al Kelley and Ira Pohl,
 AS> ANSI C edition. 
I'll leave that one to the experts, i only have C++ books, the best i have
is the Waites Group's Turbo C++.

 AS> 5... Am i using the right compiler? So far Turbo C++ v3.0 appears to
 AS> be doing the job, but....??
Yep, i have BC 4.02 and Turbo C++ 2.0, and most of the things i do 
happens in the latter. It compiles quick, but not the most efficient or
so i'm told. Watcom seems to be the pro's choice, but for the average
hobby progger i think you're ok with 3.0. You may want to look around
i believe there are patches to bring V3.0 up to 3.1.
Btw, BC4 and later , and most other current compilers i know only have a
Windows IDE.

 AS> I guess there will be a few more questions along my path, so please
Better believe it :-)
I think most ppl like to help here, (hell they even put up with me).


  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21

--- Gash
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413
SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/544 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.