www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/10/08:25:33

From: vern <vern AT iocc DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: reusing string variables
Date: Sun, 10 Jan 1999 07:04:32 -0600
Organization: none
Lines: 99
Message-ID: <3698A560.E2215062@iocc.com>
References: <3697AD5C DOT C9493E2E AT iocc DOT com> <778dup$65j$1 AT news DOT luth DOT se> <3697BB38 DOT 87B2F2D1 AT iocc DOT com> <778lf3$90j$1 AT news DOT luth DOT se>
NNTP-Posting-Host: 204.214.235.142
Mime-Version: 1.0
X-Trace: 915974115 VRL06/YYIEB8ECCD6C usenet58.supernews.com
X-Complaints-To: newsabuse AT remarQ DOT com
X-Mailer: Mozilla 4.06 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

here is the finction.  it is the part of a 'scrolling window' that
displays the messages, and scrolls them.
the locate(x, y) function moves the cursor on the screen to column x,
and row y. the clrreset() function resets the text colors.


void msginput(char *msg) /* NEEDS WORK */
{

int x = 0; /* used as a loop counter */
char msg1[78]; /* always contains line 1 */
char msg2[78]; /* always contains line 2 */
char msg3[78]; /* always contains line 3 */
char msg4[78]; /* always contains line 4 */

   textcolor(3); /* set color to cyan */

   if(count==0) /* print on the top line */
   {
      strcpy(msg1,msg);
      locate(2,19);
      cprintf("%s",msg1);
      locate(2,20);
      count++;
   }
   else if(count==1) /* print on the second line */
   {
      strcpy(msg2,msg);
      locate(2,20);
      cprintf("%s",msg2);
      locate(2,21);
      count++;
   }
   else if(count==2) /* print on the third line */
   {
      strcpy(msg3,msg);
      locate(2,21);
      cprintf("%s",msg3);
      locate(2,22);
      count++;
   }
   else if(count==3) /* print on the fourth line */
   {
      strcpy(msg4,msg);
      locate(2,22);
      cprintf("%s",msg4);
      count++;
   }
   else if(count==4) /* move everything up a line, and print the newest
line */
   {
      strcpy(msg1,msg2); /* recopy all the strings */
      strcpy(msg2,msg3);
      strcpy(msg3,msg4);
      strcpy(msg4,msg);

      locate(2,19);
     
cprintf("                                                                             
");
      cprintf("%s",msg1);
      locate(2,20);
     
cprintf("                                                                             
");
      cprintf("%s",msg2);
      locate(2,21);
     
cprintf("                                                                             
");
      cprintf("%s",msg3);
      locate(2,22);
     
cprintf("                                                                             
");
      cprintf("%s",msg4);
      locate(2,22);

   }
   clrreset();
}



Martin Str|mberg wrote:
> 
> vern (vern AT iocc DOT com) wrote:
> : doh! i am using strcpy right now, and it does not work.  I want to
> : replace the old contents of a string with new contents, which come from
> : antohter variable.
> 
> I've never had strcpy fail on me before. Are you sure you're passing
> the parameters in correct order?
> 
> Perhaps a small sample of what's not working?
> 
> Holmboe, Symphony 8,
> 
>                                                         MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019