delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/05/08:32:12

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gettex() and puttext() problem.
Date: Tue, 05 Oct 1999 04:50:30 -0400
References: <7tbjvd$vve$1 AT nnrp1 DOT deja DOT com>
X-Posted-Path-Was: not-for-mail
X-Accept-Language: en
X-ELN-Date: 5 Oct 1999 08:48:19 GMT
X-ELN-Insert-Date: Tue Oct 5 01:55:06 1999
Organization: Nocturnal Aviation
Lines: 85
Mime-Version: 1.0
NNTP-Posting-Host: dialup-209.246.92.61.newyork2.level3.net
Message-ID: <37F9BBD6.DBEAFF80@earthlink.net>
X-Mailer: Mozilla 4.7 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


hank_heng AT hotmail DOT com wrote:
> 
> Hi,
> 
>   I try to compile the fillowing code, there is no error when compile
> time, but when I try to run the compiled executable, it crash, and when
> I try to debug it with "symify", it point back to the end of file is
> causing error, this does not make any sense at all...
> 
>   The following is my code, what is wrong with it ?

You are trying to store 242 bytes of information into a single byte. 
This is obviously impossible.  Here is a working version:

#include <conio.h>
#include <stdio.h>

int main(void)
{
    int test = 3;
    char destination[242];  /* window is 11 rows * 11 cols *
                            (1 char for contents + 1 for attributes) */

    /* capture screen character */
    test = gettext(10, 10, 20, 20, &destination);

    printf("gettext test = %d.\n", test);
    printf("press any key to continue...\n");
    getch();
    clrscr();
    getch();

    /* putting back screen character */
    test = puttext(10, 10, 20, 20, &destination);
    printf("puttext test = %d.\n", test);
    return 0;
}






/* vi: set cindent ts=4 sw=4 et tw=72: */

> 
> #include <conio.h>
> #include <stdio.h>
> 
> main()
> {
>   int test=3;
>   char destination;
>   void *des = &destination;
> 
>   /* capture screen character */
>   test = gettext(10, 10, 20, 20, des);
> 
>   printf("gettext test = %d.\n", test);
> 
>   printf("press any key to continue...\n");
>   getch();
>   clrscr();
>   getch();
> 
>   /* putting back screen character */
>   test = puttext(10, 10, 20, 20, des);
>   printf("puttext test = %d.\n", test);
> }
> 
>   Thankx for helping me out.
> 
> Hank
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
Martin Ambuhl	mambuhl AT earthlink DOT net

__________________________________________________________
Fight spam now!
Get your free anti-spam service: http://www.brightmail.com

- Raw text -


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