sau Inregistrare
  
Pagina 1 din 1
  • Nu poti crea un subiect nou
  • Nu puteti raspunde pe acest topic

cine ma ajuta Evaluare topic: - - - - -

#1 Utilizator offline   hodos 

  • Ghiocel
  • Grup: Members
  • Mesaje: 1
  • Inregistrat: 15-April 06

  Scris 15 April 2006 - 09:00 PM

cine imi explica ce se intampla aici si de ce nu imi merge !! imi afiseaza : " not enough heap space in save_screen () "
Va rog sa imi explice cineva . Multumesc !! :flowers:



#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <alloc.h>

void save_screen(void far *buf[4]);
void restore_screen(void far *buf[4]);

int maxx, maxy;

int main(void)
{
int gdriver=DETECT, gmode, errorcode;
void far *ptr[4];

/* auto-detect the graphics driver and mode */
initgraph(&gdriver, &gmode, "i:\\borlandc\\bgi");
errorcode = graphresult(); /* check for any errors */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
maxx = getmaxx();
maxy = getmaxy();

/* draw an image on the screen */
rectangle(0, 0, maxx, maxy);
line(0, 0, maxx, maxy);
line(0, maxy, maxx, 0);

save_screen(ptr); /* save the current screen */
getch(); /* pause screen */
cleardevice(); /* clear screen */
restore_screen(ptr); /* restore the screen */
getch(); /* pause screen */

closegraph();
return 0;
}

void save_screen(void far *buf[4])
{
unsigned size;
int ystart=0, yend, yincr, block;

yincr = (maxy+1) / 4;
yend = yincr;
size = imagesize(0, ystart, maxx, yend);
/* get byte size of image */

for (block=0; block<=3; block++)
{
if ((buf[block] = farmalloc(size)) == NULL)
{
closegraph();
printf("Error: not enough heap space in save_screen().\n");
exit(1);
}

getimage(0, ystart, maxx, yend, buf[block]);
ystart = yend + 1;
yend += yincr + 1;
}
}

void restore_screen(void far *buf[4])
{
int ystart=0, yend, yincr, block;

yincr = (maxy+1) / 4;
yend = yincr;

for (block=0; block<=3; block++)
{
putimage(0, ystart, buf[block], COPY_PUT);
farfree(buf[block]);
ystart = yend + 1;
yend += yincr + 1;
}
}
0

#2 Utilizator offline   KingOBeer 

  • Lalea
  • PipPipPip
  • Grup: Full Members
  • Mesaje: 123
  • Inregistrat: 08-June 05

Scris 30 April 2006 - 11:42 PM

lol

if ((buf[block] = farmalloc(size)) == NULL)
{
closegraph();
printf("Error: not enough heap space in save_screen().\n");
exit(1);
}


Doar asa ai scris in program :o:
0

Reclama



Impartaseste acest subiect:


Pagina 1 din 1
  • Nu poti crea un subiect nou
  • Nu puteti raspunde pe acest topic


Subiecte similare Collapse

  Topic Deschis de Replici Vizualizari
Replici noi Web designeri: atentie la numele pozelor roportal  3 5.958
Replici noi Fox
adaugare poza in baza de date
???  1 5.670
Replici noi Delphi help
cum pot accesa portul paralel?
istrateclaudiu  2 2.504
Replici noi Citire fisier linie cu linie flobeats  11 6.373
Replici noi alte probleme in mingw Alex_here  4 1.156