|
Hello,
I am running Borland 5.5 Compiler.
I should work with big arrays.
My program compile and works fine with small arrays but when i increase the size (more than 15000 float elements)it compiles but it deosnt work.
I think the problem is a lack of memory.
So i tried to allocate memory with the command ilink32 -H:
but it did not work,.
Does anybody know how to increase the size of the memory allocated with borland 5.5 compiler for windows (dos).
thank you
Alberto
|
|
|
Unless you are compiling project as DPMI-32(DOS Protected Mode) or Win32 Console program, memory allocation is limited to 64KB chunks. This means that any one object in your program can't exceed 64KBytes. DPMI32 and WIN32 concole programs have 32-bit addressing.
The size of a float is 4-bytes. An arrray of float with 15,000 elements is 60,000KB. You can have of approx. 16,380 elements with no problems.
DPMI-32 projects are only available with Borland C++ v4.52; and then only if you've installed the "PowerPack Add-on"
I compile using Boland C++ 5.02 IDE for quick & dirty programs, and C++ Builder v6 for larger projects. I believe the 5.02 IDE used v5.2 of Boland's C/C++ compiler. Both have an option for creating WIN32 console projects. Not familiar with command-line compiler, but I have to think you can compile program as WIN32 Console. Probably have to use BCC32.EXE instead of BCC.EXE.
|
|
|
Unless you are compiling project as DPMI-32(DOS Protected Mode) or Win32 Console program, memory allocation is limited to 64KB chunks. This means that any one object in your program can't exceed 64KBytes. DPMI32 and WIN32 concole programs have 32-bit addressing.
The size of a float is 4-bytes. An arrray of float with 15,000 elements is 60,000KB. You can have of approx. 16,380 elements with no problems.
DPMI-32 projects are only available with Borland C++ v4.52; and then only if you've installed the "PowerPack Add-on"
I compile using Boland C++ 5.02 IDE for quick & dirty programs, and C++ Builder v6 for larger projects. I believe the 5.02 IDE used v5.2 of Boland's C/C++ compiler. Both have an option for creating WIN32 console projects. Not familiar with command-line compiler, but I have to think you can compile program as WIN32 Console. Probably have to use BCC32.EXE instead of BCC.EXE.
|
|
|
Unless you are compiling project as DPMI-32(DOS Protected Mode) or Win32 Console program, memory allocation is limited to 64KB chunks. This means that any one object in your program can't exceed 64KBytes. DPMI32 and WIN32 concole programs have 32-bit addressing.
The size of a float is 4-bytes. An arrray of float with 15,000 elements is 60,000KB. You can have of approx. 16,380 elements with no problems.
DPMI-32 projects are only available with Borland C++ v4.52; and then only if you've installed the "PowerPack Add-on"
I compile using Boland C++ 5.02 IDE for quick & dirty programs, and C++ Builder v6 for larger projects. I believe the 5.02 IDE used v5.2 of Boland's C/C++ compiler. Both have an option for creating WIN32 console projects. Not familiar with command-line compiler, but I have to think you can compile program as WIN32 Console. Probably have to use BCC32.EXE instead of BCC.EXE.
|
|
|
Don't know what's up with the three identical replies. Anyway, if you want to compile a WIN32 console program using command-line compiler, just include the "-WC" option which indicates "Windows console" compile.
I compiled the source code below with the simple command line:
BCC32.EXE test.cpp -WC <Enter>
I tested the resulting executable against a 13MByte input file. Since the input file was 13MBytes in size, the character array I created was also 13Mbytes in size. I performed a file compare against input and output files and they were identical so the program is working correctly.
Hope this helps.
//*************************************
//This program does the following:
// - opens a file for reading
// - creates a character array the size of the file.
// - reads file contents into character array
// - writes character array to output file.
//*************************************
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
main(int argc, char **argv)
{
//*************************************
// argv[1] - input file
// argv[2] - output file
//*************************************
char *buffer;
int amt_read;
FILE *infile;
infile=fopen(argv[1], "rb");
if(!infile){
printf("Unable to open [%s]\n\n", argv[1]);
return 0;
}
amt_read = filelength(fileno(infile));
buffer = new char[amt_read+1];
fread(buffer, sizeof(char), amt_read, infile);
buffer[amt_read]='\0';
fclose(infile);
infile=fopen(argv[2], "wb");
if(!infile){
printf("Unable to open [%s]\n\n", argv[2]);
return 0;
}
fwrite(buffer, sizeof(char), amt_read, infile);
fclose(infile);
return 0;
}
//*************************************
//*************************************
|
|
|
|
|
|
|
// |