www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/23/17:15:22

From: Alejandro Martin Sanchez <alesan AT iname DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Answer to allocate memory for VAMPYR
Date: Fri, 23 Jan 1998 19:14:46 -0300
Organization: Argentina On-Line
Lines: 35
Message-ID: <34C91654.77322958@iname.com>
NNTP-Posting-Host: pc2.cba.com.ar
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

VAMPYR wrote:

> How to make DJGPP use memory more than 1MB(or more)?
>
> This is my test file:
> ===========================
> void main()
> {
>   char array[1024000];
> }
> ===========================
> I compiled with "gcc test.c -o test.exe" , but it appears error!
> How should I do?

You should be use the "new" keyword to allocate memory.
Example:

void main(void)
{
    char *foo;

    foo = new char [2000000L];
    if (foo == NULL)
    {
        printf("Error: I can not allocate 2Mb\n");
        return;
    }
    delete foo;
}

==================================================
Alejandro Martin Sanchez <alesan AT iname DOT com>
Cordoba, Argentina


- Raw text -


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