delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/05/02:16:09

From: "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gettex() and puttext() problem.
Date: Mon, 4 Oct 1999 22:55:29 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 57
Message-ID: <7tbsvl$nms$1@solomon.cs.rose-hulman.edu>
References: <7tbjvd$vve$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: yerricde.laptop.rose-hulman.edu
X-Trace: solomon.cs.rose-hulman.edu 939095861 24284 137.112.205.146 (5 Oct 1999 03:57:41 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 5 Oct 1999 03:57:41 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
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 in message news:7tbjvd$vve$1 AT nnrp1 DOT deja DOT com...
> 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 ?
>
>
> #include <conio.h>
> #include <stdio.h>
>
> main()
> {
>   int test=3;
>   char destination;
>   void *des = &destination;

You only allocated one byte for destination. How do
you expect that much of the screen to fit in one byte?
Replace the two previous lines with

short des[4096];

This allocates 8 kilobytes, which should be safe in nearly all text modes.

>
>
>   /* 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.

No problem.

--
Damian Yerrick
http://come.to/yerrick
The downside of soul food is fat.


- Raw text -


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